Technical Names
-
- Posts: 4
- Joined: Thu Aug 23, 2007 7:36 pm
- Contact:
Technical Names
I'm working on an OO port of Chipmunk to C# so I'm creating nice named properties for all the values. I'm currently working on cpBody and just wondering: are there technical terms for v_bias and w_bias? I was thinking VelocityBias and RotationalBias, but I'm not sure if there are better names to use. Thanks for any guidance.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Technical Names
Yeah, those would be well suited. If you want to be really picky, it's the angular velocity, but that's a pretty long name for such a common attribute.
A little off topic: For the record, I left them as single letter names so that equations would be more readable. (at least to a) Though I think I've definitly been asked 20 times what body.w is.
Having read the equations a lot on paper, this more recognizable to me:
than this:
A little off topic: For the record, I left them as single letter names so that equations would be more readable. (at least to a) Though I think I've definitly been asked 20 times what body.w is.
Having read the equations a lot on paper, this more recognizable to me:
Code: Select all
static inline void
cpBodyApplyImpulse(cpBody *body, cpVect j, cpVect r)
{
body->v = cpvadd(body->v, cpvmult(j, body->m_inv));
body->w += body->i_inv*cpvcross(r, j);
}
Code: Select all
static inline void
cpBodyApplyImpulse(cpBody *body, cpVect impulse, cpVect location)
{
body->velocity = cpvadd(body->velocity, cpvmult(impulse, body->mass_inv));
body->angular_velocity += body->moment_of_inertia_inv*cpvcross(location, impulse);
}
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 3
- Joined: Sun Nov 11, 2007 5:23 am
- Contact:
Re: Technical Names
Technically the "w" isn't a w at all, but a lower-case omega (which happens to look a bit like a w). So it's written "w" but pronounced "omega"
If the forum allows it, it's
ω
Mark
If the forum allows it, it's
ω
Mark
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Technical Names
It's true. Same with 'u', it should really be a mu character. I've seriously thought about changing the names to something sensible. I think the only thing holding me back at this point is that it would break existing code and you can't alias names in C. I'll probably do it with the next major release, but until then it's sort of stuck.
I'm not really a fan of extremely verbose names. On the other hand, I'm generally opposed to one letter names, but then I went and did it anyway.
My rationale was that common equations are more recognizable if they look like the way you would write them. Unfortunately when you mix in structs and dereferencing it just ended up not being possible.
I'm not really a fan of extremely verbose names. On the other hand, I'm generally opposed to one letter names, but then I went and did it anyway.

Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 18
- Joined: Wed Sep 26, 2007 8:19 pm
- Contact:
Re: Technical Names
I'm personally fine with the names you're using already, but maybe it's because I'm used to it now. 
Tee hee, I just discovered MSVC handles Unicode. Cute. ω could literally be the variable name on that system (though probably breaking it on the rest).
One thing I do like in other libraries I use is heavy commenting with function/struct names, since it shows up with Intellisense in MSVC.

Tee hee, I just discovered MSVC handles Unicode. Cute. ω could literally be the variable name on that system (though probably breaking it on the rest).
One thing I do like in other libraries I use is heavy commenting with function/struct names, since it shows up with Intellisense in MSVC.
-
- Posts: 3
- Joined: Tue Jan 13, 2009 7:57 am
- Contact:
Re: Technical Names
Sorry to bump such an old post, but you can certainly "alias" names in C by using unions:slembcke wrote:I think the only thing holding me back at this point is that it would break existing code and you can't alias names in C. I'll probably do it with the next major release, but until then it's sort of stuck.
Code: Select all
union {
cpVect p;
cpVect position;
};
Dan
Who is online
Users browsing this forum: No registered users and 11 guests