How to use the function getEdges ? and another thing

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Raptor88
Posts: 4
Joined: Fri May 12, 2006 5:35 pm
Location: Viterbo (ITALY)
Contact:

How to use the function getEdges ? and another thing

Post by Raptor88 »

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 :D
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Post by Baal Cadar »

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.
Raptor88
Posts: 4
Joined: Fri May 12, 2006 5:35 pm
Location: Viterbo (ITALY)
Contact:

Post by Raptor88 »

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.
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! :lol:
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

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.
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.


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
Raptor88
Posts: 4
Joined: Fri May 12, 2006 5:35 pm
Location: Viterbo (ITALY)
Contact:

Post by Raptor88 »

thank you for the explanation, but I don't understand!!! LOL... Can you repeat me the procedure? thanks
Image
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Post by Baal Cadar »

dhenton9000, I think we already established that we have different opinions on many topics. Others != All others. I understand this and so should you. :)

I really want to know what ticks you so off with me, this is not the first time. :?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

(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.
Duncan Mac Leod
Posts: 64
Joined: Sun May 22, 2005 3:06 pm
Location: Germany
Contact:

Post by Duncan Mac Leod »

Raptor88 wrote:thank you for the explanation, but I don't understand!!! LOL... Can you repeat me the procedure? thanks
Hmm - for what purpose do you want to use getEdges ?? Would be nice if you can describe your problem more clearly...

Duncan
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I would to expand the dimension of the box
It sounds like he just wants to make an expanded box from the original. That is easy.

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;
}
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

Raptor88 wrote:thank you for the explanation, but I don't understand!!! LOL... Can you repeat me the procedure? thanks
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:

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. :oops:

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...... :arrow:
Raptor88
Posts: 4
Joined: Fri May 12, 2006 5:35 pm
Location: Viterbo (ITALY)
Contact:

Post by Raptor88 »

thankz guys :D Instead, for the question about the variable? how to display the content of a variable on the screen??? :?:
Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Either CGUIStaticText or TextSceneNode, depending on whether you want the text within the GUI or the 3d world.
Post Reply