Hi guys, I'm trying to play with 3D vectors, I'm using toxi's ones but my problem is about 3d in general).
I've a motion defined by a Vec3D. I can easily draw the direction of it doing:
Code:
private void drawVec(Vec3D v, Point3D p, float radius)
{
float ax = getContextualAngle(v.x);
float ay = getContextualAngle(v.y);
float az = getContextualAngle(v.z);
float dx = radius * sin(ax);
float dy = radius * sin(ay);
float dz = radius * sin(az);
Point3D newP = new Point3D(p.x + dx, p.y + dy, p.z + dz);
drawLine(0x00FF00, p,newP);
}
where getContextualAngle is simply
Code:
private float getContextualAngle(float vecAngle)
{
// R90 is radians(90)
return map(vecAngle, -1, 1, -R90, R90);
}
I would like to define that circle perpendicular to the vector (each point is equally distant from the next point resulting from the vector).
As start I thought to try and drawing it, so one translated to a point rotating the camera I could simply drawing it, but my problem is of course finding out the rotations to apply. My problem I presume is also in understanding if I have to rotate only on two axis.
Any tips a part study geometry?
Thanks, chr