How to use the function getEdges ? and another thing
How to use the function getEdges ? and another thing
Hello, I'm new in this forum! sorry but I'm Italian and I don't speak english very well. I have a question about the abbox3d and the function getEdges, how to use? I try to use it but I receive a lot of error. And another thing: how to visualize the content of a variable on the screen? thanks
-
- Posts: 377
- Joined: Fri Oct 28, 2005 10:28 am
- Contact:
hey, stay calm! so, I have a node and a aabbox3d. I trasform the node in a boundingbox and assign it to the aabbox3d. after I would to expand the dimension of the box, then I suppose that I have to take the edges of the box and expand that, but I have a problem with this. I try to use the getEdges function, but I don't understand how to use it. There are somebody that explain to me? Again sorry for my very bad english!Baal Cadar wrote:Not being native english speaker doesn't mean you can ask sloppy questions.
How do you use getEdges now and what are the errors you get? Don't be lazy yourself and expect others to figure it all out for you.
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
This is downright offensive. In the future, when using the phrase "others", please list me as an exception. I see nothing wrong with this question.Baal Cadar wrote:Not being native english speaker doesn't mean you can ask sloppy questions.
How do you use getEdges now and what are the errors you get? Don't be lazy yourself and expect others to figure it all out for you.
I think getEdges returns the abolute position of the 8 points of a bounding box, (so why don't they call it getPoints??).
You might want to check it out by running a little experiment such as inspecting the results from getEdges on a node that is positioned at the origin. addTestSceneNode might help
I just tried this and got some unhelpful results getEdges returns the Untransformed positions of the 8 original points. So I'm thinking if you get the absolute transformation of the node and apply it to the results of get edges, you will have what you are looking for which is a transformed bounding box.
HTH
-
- Posts: 377
- Joined: Fri Oct 28, 2005 10:28 am
- Contact:
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
(hey dhenton, if you really knew what errors this guy received you must have some very special abilities...)
Anyway, the method returns 8 vectors pointing to the corner points of the bbox. You have to provide allocated memory for the 8 vectors, though since the method does not use core::array.
BTW: There is no such concept of a transformed bbox inside aabbox.h - so of course it just uses the coordinates stored within the bbox. If you take an untransformed bbox you won't get them transformed automatically.
Anyway, the method returns 8 vectors pointing to the corner points of the bbox. You have to provide allocated memory for the 8 vectors, though since the method does not use core::array.
BTW: There is no such concept of a transformed bbox inside aabbox.h - so of course it just uses the coordinates stored within the bbox. If you take an untransformed bbox you won't get them transformed automatically.
-
- Posts: 64
- Joined: Sun May 22, 2005 3:06 pm
- Location: Germany
- Contact:
It sounds like he just wants to make an expanded box from the original. That is easy.I would to expand the dimension of the box
Code: Select all
template< class T >
void expandBox(aabbox3d<T>& box, T amount)
{
amount = amount / 2;
box.MinEdge.X -= amount;
box.MinEdge.Y -= amount;
box.MinEdge.Z -= amount;
box.MaxEdge.X += amount;
box.MaxEdge.Y += amount;
box.MaxEdge.Z += amount;
}
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
I'm assuming that what you want to do is calculate a modified bounding box for a node that has either been scaled, translated, or rotated. If that is the case, you might want to try:Raptor88 wrote:thank you for the explanation, but I don't understand!!! LOL... Can you repeat me the procedure? thanks
Code: Select all
ISceneNode* zz = smgr->addTestSceneNode(10,NULL);
vector3df edges[8];
zz->setScale(vector3df(0.5f,0.5f,0.5f));
zz->setPosition(vector3df(-5,-5,-5));
zz->updateAbsolutePosition();
aabbox3d<f32> bbb = zz->getBoundingBox();
zz->setMaterialFlag(EMF_LIGHTING,true);
zz->getMaterial(0).EmissiveColor.set(255,255,0,0);
zz->setDebugDataVisible(true);
zz->getMaterial(0).Wireframe= true;
matrix4 mm = zz->getAbsoluteTransformation();
mm.transformBox(bbb);
bbb.getEdges(edges);
printf("point 0 %4.3f,%4.3f,%4.3f\n",edges[0].X,edges[0].Y,edges[0].Z);
You can then view the effect on the edges buffer of using the AbsoluteTransformation and see if it is what you are looking for.
/////////////////////////////
Baal Cadar--
I've always found your answers helpful and have learned a lot from them, bummer that you think I've been hostile in the past. I hadn't intended a vendetta, but I could be less flippant in the future.
I just felt I had to say something here.
Would love to say more about the level of civility in these forums, but I'm sure there is a forum mod just waiting to lock me out and lecture me for lack of respect to the Irrlicht Gods. Most likely my last post. Perhaps I'll go the way of Midnight......