I'm putting together a Nim wrapper for Box2D using c2nim
.
Box2D has its own mathematical vector class, b2Vec2
. If I were using Box2D in raw C++, I'd just use that class. Simple.
But Nim already has such functionality in the basic2d
module's Vector2d
type.
I want my wrapper's interface to use the built-in Vector2d
type so that users of this wrapper don't have to mentally juggle two different vector types. This entails somehow using Vector2d
as a Nim interface to b2Vec2
. How can I do this?
Things of note:
BothI'm wrong. Nimb2Vec2
andVector2d
are made of just two 32-bitfloat
s.float
s are 64-bit.Vector2d
is part of the Nim standard library, so I can't modify its definition.- I'll create a wrapper for
b2Vec2
if I have to, but I'd like to avoid doing so, and I definitely don't want users to see it.