本文整理汇总了C++中Matrix3::RotateZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::RotateZ方法的具体用法?C++ Matrix3::RotateZ怎么用?C++ Matrix3::RotateZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3
的用法示例。
在下文中一共展示了Matrix3::RotateZ方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
BendDeformer::BendDeformer(
TimeValue t, ModContext &mc,
float angle, float dir, int naxis,
float from, float to, int doRegion,
Matrix3& modmat, Matrix3& modinv)
{
this->doRegion = doRegion;
this->from = from;
this->to = to;
Matrix3 mat;
Interval valid;
time = t;
tm = modmat;
invtm = modinv;
mat.IdentityMatrix();
switch (naxis) {
case 0: mat.RotateY( -HALFPI ); break; //X
case 1: mat.RotateX( HALFPI ); break; //Y
case 2: break; //Z
}
mat.RotateZ(DegToRad(dir));
SetAxis(mat);
assert (mc.box);
bbox = *mc.box;
CalcR(naxis,DegToRad(angle));
// Turn this off for a sec.
this->doRegion = FALSE;
float len = to-from;
float rat1, rat2;
if (len==0.0f) {
rat1 = rat2 = 1.0f;
} else {
rat1 = to/len;
rat2 = from/len;
}
Point3 pt;
tmAbove.IdentityMatrix();
tmAbove.Translate(Point3(0.0f,0.0f,-to));
tmAbove.RotateY(DegToRad(angle * rat1));
tmAbove.Translate(Point3(0.0f,0.0f,to));
pt = Point3(0.0f,0.0f,to);
tmAbove.Translate((Map(0,pt*invtm)*tm)-pt);
tmBelow.IdentityMatrix();
tmBelow.Translate(Point3(0.0f,0.0f,-from));
tmBelow.RotateY(DegToRad(angle * rat2));
tmBelow.Translate(Point3(0.0f,0.0f,from));
pt = Point3(0.0f,0.0f,from);
tmBelow.Translate((Map(0,pt*invtm)*tm)-pt);
this->doRegion = doRegion;
}
示例2: Inverse
SkewDeformer::SkewDeformer(
ModContext &mc,
float amount, float dir, int naxis,
float from, float to, int doRegion,
Matrix3& modmat, Matrix3& modinv)
{
this->doRegion = doRegion;
this->from = from;
this->to = to;
Matrix3 mat;
mat.IdentityMatrix();
switch (naxis) {
case 0: mat.RotateY( -HALFPI ); break; //X
case 1: mat.RotateX( HALFPI ); break; //Y
case 2: break; //Z
}
mat.RotateZ(DegToRad(dir));
tm = modmat * mat;
invtm = Inverse(mat) * modinv;
assert (mc.box);
bbox = *mc.box;
float len = 0.0f;
if (!doRegion) {
switch (naxis) {
case 0: len = bbox.pmax.x - bbox.pmin.x; break;
case 1: len = bbox.pmax.y - bbox.pmin.y; break;
case 2: len = bbox.pmax.z - bbox.pmin.z; break;
}
} else {
len = to-from;
}
if (len==0.0f) len = 0.000001f;
amountOverLength = amount/len;
}