Page 1 of 1
Technical Names
Posted: Thu Aug 23, 2007 7:43 pm
by Nick
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.
Re: Technical Names
Posted: Thu Aug 23, 2007 9:35 pm
by slembcke
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:
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);
}
than this:
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);
}
Re: Technical Names
Posted: Sun Nov 11, 2007 5:27 am
by MarkR
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
Re: Technical Names
Posted: Sun Nov 11, 2007 1:24 pm
by slembcke
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.
Re: Technical Names
Posted: Tue Nov 13, 2007 6:16 am
by joshcryer
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.
Re: Technical Names
Posted: Tue Jan 13, 2009 8:01 am
by Dan East
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.
Sorry to bump such an old post, but you can certainly "alias" names in C by using unions:
Code: Select all
union {
cpVect p;
cpVect position;
};
Then cpBody:p and cpBody:postion are synonymous.
Dan