Hi everybody,
I'm currently a bit confused by the name of the btRigidBody::upcast() method. We are casting from btCollisionObject to btRigidBody, which is derived from btCollisionObject, so we are moving down the class-hierarchy.
Or am I getting something wrong here?
btRigidBody::upcast() is a downcast?
-
robagar
- Posts: 48
- Joined: Fri May 21, 2010 1:49 am
Re: btRigidBody::upcast() is a downcast?
yup, it's the wrong way round. But it kind of makes sense as opposed to going "up" towards the "base" 
-
B_old
- Posts: 79
- Joined: Tue Sep 26, 2006 1:10 pm
Re: btRigidBody::upcast() is a downcast?
I agree, that this can sound confusing at first. But once you are used to viewing and calling it this way, it is even more confusing to encounter stuff that does it the other way round.robagar wrote:But it kind of makes sense as opposed to going "up" towards the "base"
What is the intention behind this naming-choice?
-
Flix
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: btRigidBody::upcast() is a downcast?
I'm not a C++ expert at all, but I've always thought that "upast" is the cast that goes up in the hierarchy (more derived classes).
-
B_old
- Posts: 79
- Joined: Tue Sep 26, 2006 1:10 pm
Re: btRigidBody::upcast() is a downcast?
Well, upcasting doesn't have to do with c++ in particular I suppose. I assumed you move upwards the hierarchy in the sense of an UML-diagram for instance ("less" derived class).
http://www.c-sharpcorner.com/UploadFile ... sting.aspx
Maybe there are two different standards as to what means what, although that would be awkward.
http://www.c-sharpcorner.com/UploadFile ... sting.aspx
Maybe there are two different standards as to what means what, although that would be awkward.
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btRigidBody::upcast() is a downcast?
My bad, the name is wrong indeed, it should be a downcast.
Best not to break the API for this, we can put a warning there and fix it for a Bullet 3.x release.
Thanks!
Erwin
Best not to break the API for this, we can put a warning there and fix it for a Bullet 3.x release.
Thanks!
Erwin
-
B_old
- Posts: 79
- Joined: Tue Sep 26, 2006 1:10 pm
Re: btRigidBody::upcast() is a downcast?
OK, thanks for clearing it up.