void Compute_Coordinate_Transform(TRANSFORM *trans, const VECTOR origin, VECTOR up, DBL radius, DBL length) { TRANSFORM trans2; VECTOR tmpv; Make_Vector(tmpv, radius, radius, length); Compute_Scaling_Transform(trans, tmpv); if (fabs(up[Z]) > 1.0 - EPSILON) { Make_Vector(tmpv, 1.0, 0.0, 0.0); up[Z] = up[Z] < 0.0 ? -1.0 : 1.0; } else { Make_Vector(tmpv, -up[Y], up[X], 0.0); } Compute_Axis_Rotation_Transform(&trans2, tmpv, acos(up[Z])); Compose_Transforms(trans, &trans2); Compute_Translation_Transform(&trans2, origin); Compose_Transforms(trans, &trans2); }
void Camera::Scale(const VECTOR Vector) { TRANSFORM Trans; Compute_Scaling_Transform(&Trans, Vector); Transform(&Trans); }
void Scale_Skysphere(SKYSPHERE *Skysphere, const VECTOR Vector) { TRANSFORM Trans; Compute_Scaling_Transform(&Trans, Vector); Transform_Skysphere(Skysphere, &Trans); }
void Scale_Camera(CAMERA *Camera, VECTOR Vector) { TRANSFORM Trans; Compute_Scaling_Transform(&Trans, Vector); Transform_Camera(Camera, &Trans); }