本文整理汇总了C++中Matrix44F::transformAsNormal方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix44F::transformAsNormal方法的具体用法?C++ Matrix44F::transformAsNormal怎么用?C++ Matrix44F::transformAsNormal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix44F
的用法示例。
在下文中一共展示了Matrix44F::transformAsNormal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: perform
void TransformManipulator::perform(const Ray * r)
{
if(isDetached()) return;
const Vector3F worldP = worldSpace().getTranslation();
Matrix44F ps;
parentSpace(ps);
Plane pl(ps.transformAsNormal(hitPlaneNormal()), worldP);
Vector3F hit, d;
float t;
if(pl.rayIntersect(*r, hit, t, 1)) {
d = hit - worldP;
if(d.length() > 10.f) return;
if(m_mode == ToolContext::RotateTransform) {
d = d.normal() * 8.f;
hit = worldP + d;
}
d = hit - m_currentPoint;
if(m_mode == ToolContext::MoveTransform)
move(d);
else
spin(d);
m_currentPoint = hit;
}
}
示例2: spin
void TransformManipulator::spin(const Vector3F & d)
{
Matrix44F ps;
parentSpace(ps);
Matrix44F invps = ps;
invps.inverse();
const Vector3F worldP = ps.transform(translation());
const Vector3F rotUp = ps.transformAsNormal(hitPlaneNormal());
Vector3F toa = m_currentPoint - worldP;
Vector3F tob = toa + d;
toa.normalize();
tob.normalize();
float ang = toa.angleBetween(tob, toa.cross(rotUp).reversed());
Vector3F angles;
if(m_rotateAxis == AY) angles.set(0.f, ang, 0.f);
else if(m_rotateAxis == AZ) angles.set(0.f, 0.f, ang);
else angles.set(ang, 0.f, 0.f);
m_subject->rotate(angles);
setRotationAngles(m_subject->rotationAngles());
}
示例3: move
void TransformManipulator::move(const Vector3F & d)
{
Matrix44F ps;
parentSpace(ps);
Matrix44F invps = ps;
invps.inverse();
Vector3F od = invps.transformAsNormal(d);
m_subject->translate(od);
setTranslation(m_subject->translation());
}
示例4: start
void TransformManipulator::start(const Ray * r)
{
const Vector3F worldP = worldSpace().getTranslation();
Matrix44F ps;
parentSpace(ps);
Plane pl(ps.transformAsNormal(hitPlaneNormal()), worldP);
Vector3F hit, d;
float t;
if(pl.rayIntersect(*r, hit, t, 1)) {
d = hit - worldP;
if(d.length() > 10.f) return;
if(m_mode == ToolContext::RotateTransform) {
d = d.normal() * 8.f;
hit = worldP + d;
}
m_startPoint = hit;
m_currentPoint = m_startPoint;
}
m_started = 1;
}