13 #ifndef __UT_COORDSPACEIMPL_H_INCLUDED__
14 #define __UT_COORDSPACEIMPL_H_INCLUDED__
30 myXAxis.assign(1.0, 0.0, 0.0);
31 myYAxis.assign(0.0, 1.0, 0.0);
34 myXAxis.assign(0.0, 1.0, 0.0);
35 myYAxis.assign(0.0, 0.0, 1.0);
41 myXAxis.assign(0.0, 0.0, 1.0);
42 myYAxis.assign(1.0, 0.0, 0.0);
75 n =
cross(axaxis, ayaxis);
92 myYAxis =
cross(myPlane.normal(), myXAxis);
102 template <
typename T>
113 template <
typename T>
120 myXAxis =
x;
if (norm) myXAxis.normalize();
122 if (matx.
dihedral(oldx, myXAxis,
false) != 0)
138 myYAxis *= matx; myYAxis.normalize();
139 myPlane.rotateNormal(matx,
true);
142 template <
typename T>
149 myYAxis =
y;
if (norm) myYAxis.normalize();
151 if (matx.
dihedral(oldy, myYAxis,
false) != 0)
168 myXAxis *= matx; myXAxis.normalize();
169 myPlane.rotateNormal(matx,
true);
172 template <
typename T>
180 myPlane.setVectorAsNormal(z);
182 myPlane.setNormal(z);
185 if (matx.
dihedral(oldz, n,
false) != 0)
196 myPlane.setNormal(oldz);
201 myXAxis *= matx; myXAxis.normalize();
202 myYAxis *= matx; myYAxis.normalize();
205 template <
typename T>
220 myPlane.setVectorAsNormal(z);
224 myPlane.setNormal(z);
228 template <
typename T>
234 myPlane.rotatePoint(rmatx);
239 myXAxis *= rmatx; myXAxis.normalize();
240 myYAxis *= rmatx; myYAxis.normalize();
241 myPlane.rotateNormal(rmatx,
true);
244 template <
typename T>
250 myPlane.rotatePoint(rmatx);
255 myXAxis *= rmatx; myXAxis.normalize();
256 myYAxis *= rmatx; myYAxis.normalize();
257 myPlane.rotateNormal(rmatx,
true);
260 template <
typename T>
270 matx.
translate(-origin().
x(), -origin().
y(), -origin().
z());
272 matx.
translate( origin().
x(), origin().
y(), origin().
z());
273 transformAndReturnNormalXform(matx);
276 template <
typename T>
280 myPlane.transform(matx);
287 myXAxis *= xform; myXAxis.normalize();
288 myYAxis *= xform; myYAxis.normalize();
291 template <
typename T>
296 myPlane.transformAndReturnNormalXform(matx);
298 myXAxis *= matx; myXAxis.normalize();
299 myYAxis *= matx; myYAxis.normalize();
302 template <
typename T>
306 myPlane.transform(matx);
313 myXAxis *= xform; myXAxis.normalize();
314 myYAxis *= xform; myYAxis.normalize();
317 template <
typename T>
322 myPlane.transformAndReturnNormalXform(matx);
324 myXAxis *= matx; myXAxis.normalize();
325 myYAxis *= matx; myYAxis.normalize();
328 template <
typename T>
335 myXAxis.assign(1.0, 0.0, 0.0);
336 myYAxis.assign(0.0, 1.0, 0.0);
341 template <
typename T>
342 template <
typename MATX>
349 matx.changeSpace(world_x, world_y,
355 template <
typename T>
360 matx.
translate(origin().
x(), origin().
y(), origin().
z());
364 template <
typename T>
371 matx.
translate(origin().
x(), origin().
y(), origin().
z());
374 template <
typename T>
384 int ret = rmatx.
crack(rvals, order);
386 rx = rvals[0]; ry = rvals[1]; rz = rvals[2];
391 template <
typename T>
402 int ret = rmatx.
crack(rvals, order);
404 rx = rvals[0]; ry = rvals[1]; rz = rvals[2];
409 template <
typename T>
414 r.
x() = rel.
x()*xaxis().x()+rel.
y()*yaxis().x()+rel.
z()*zaxis().x();
415 r.
y() = rel.
x()*xaxis().y()+rel.
y()*yaxis().y()+rel.
z()*zaxis().y();
416 r.
z() = rel.
x()*xaxis().z()+rel.
y()*yaxis().z()+rel.
z()*zaxis().z();
421 template <
typename T>
426 r.
x() = rel.
x()*xaxis().x()+rel.
y()*yaxis().x()+rel.
z()*zaxis().x();
427 r.
y() = rel.
x()*xaxis().y()+rel.
y()*yaxis().y()+rel.
z()*zaxis().y();
428 r.
z() = rel.
x()*xaxis().z()+rel.
y()*yaxis().z()+rel.
z()*zaxis().z();
432 #endif // __UT_COORDSPACEIMPL_H_INCLUDED__
static UT_Matrix3T< T > rotationMat(UT_Vector3T< S > &axis, T theta, int norm=1)
void getTransformMatrixPreservingOrigin(UT_Matrix4T< T > &matx) const
const UT_Vector3T< T > & yaxis() const
void convertToWorld(UT_Vector3T< T > &rel) const
void convertToWorldNoOriginAdj(UT_Vector3T< T > &rel) const
int fromWorldRotation(T &rx, T &ry, T &rz, const UT_XformOrder &order) const
GLdouble GLdouble GLdouble z
constexpr SYS_FORCE_INLINE T & z() noexcept
GLboolean GLboolean GLboolean GLboolean a
void getTransformMatrix(UT_Matrix4T< T > &matx) const
void identity()
Set the matrix to identity.
void transformAndReturnNormalXform(UT_Matrix4F &matx)
constexpr SYS_FORCE_INLINE void negate() noexcept
static UT_Matrix3T< T > dihedral(UT_Vector3T< S > &a, UT_Vector3T< S > &b, UT_Vector3T< S > &c, int norm=1)
const UT_Vector3T< T > & zaxis() const
void transform(const UT_Matrix4F &matx)
GLdouble GLdouble GLint GLint order
int toWorldRotation(T &rx, T &ry, T &rz, const UT_XformOrder &order) const
void rotate(UT_Vector3T< T > &axis, T theta, bool norm=true)
void identity()
Set the matrix to identity.
const UT_Vector3T< T > & xaxis() const
void translate(T dx, T dy, T dz=0)
UT_CoordSpaceT(UT_PlaneType p=UT_PLANE_XY)
void setAxes(const UT_Vector3T< T > &x, const UT_Vector3T< T > &y, const UT_Vector3T< T > &z, bool norm=true)
SYS_FORCE_INLINE UT_StorageMathFloat_t< T > normalize() noexcept
void rotate(UT_Vector3T< S > &axis, T theta, int norm=1)
SYS_FORCE_INLINE void normal(const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb)
constexpr SYS_FORCE_INLINE T & y() noexcept
SIM_DerVector3 cross(const SIM_DerVector3 &lhs, const SIM_DerVector3 &rhs)
int crack(UT_Vector3T< S > &rvec, const UT_XformOrder &order) const
constexpr SYS_FORCE_INLINE T & x() noexcept