本文整理汇总了C#中Matrix4F.Normalize方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix4F.Normalize方法的具体用法?C# Matrix4F.Normalize怎么用?C# Matrix4F.Normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4F
的用法示例。
在下文中一共展示了Matrix4F.Normalize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetManipulatorMatrix
protected override Matrix4F GetManipulatorMatrix()
{
ITransformable node = GetManipulatorNode(TransformationTypes.Rotation);
if (node == null ) return null;
Path<DomNode> path = new Path<DomNode>(node.Cast<DomNode>().GetPath());
Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1);
// local transform
Matrix4F toworld = new Matrix4F(localToWorld);
// Offset by rotate pivot
Matrix4F P = new Matrix4F();
P.Translation = node.Pivot;
toworld.Mul(P, toworld);
// Normalize
toworld.Normalize(toworld);
return toworld;
}
示例2: OnBeginDrag
public override void OnBeginDrag()
{
if (m_hitRegion == HitRegion.None)
return;
var selectionCntx = DesignView.Context.As<ISelectionContext>();
var selection = selectionCntx.Selection;
var transactionContext = DesignView.Context.As<ITransactionContext>();
m_activeOp = null;
var op = new ManipulatorActiveOperation(
"Rotate", DesignView.Context.As<ISelectionContext>(),
(ITransformable node) => (node.TransformationType & TransformationTypes.Rotation) != 0,
false);
m_rotations = new Matrix4F[op.NodeList.Count];
for (int k = 0; k < op.NodeList.Count; k++)
{
ITransformable node = op.NodeList[k];
Matrix4F m = new Matrix4F(node.Transform);
m.Translation = new Vec3F(0, 0, 0);
m.Normalize(m);
m_rotations[k] = m;
}
m_activeOp = op;
}
示例3: GetManipulatorMatrix
protected override Matrix4F GetManipulatorMatrix()
{
ITransformable node = GetManipulatorNode(TransformationTypes.Translation);
if (node == null) return null;
ISnapSettings snapSettings = (ISnapSettings)DesignView;
Path<DomNode> path = new Path<DomNode>(node.Cast<DomNode>().GetPath());
Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1);
Matrix4F toworld = new Matrix4F();
if (snapSettings.ManipulateLocalAxis)
{
toworld.Set(localToWorld);
toworld.Normalize(toworld);
}
else
{
toworld.Translation = localToWorld.Translation;
}
// DavidJ -- note -- this "pivot" behaviour was inherited from another manipulator
// but appears to be broken! Check coordinate space of value returned from CalcSnapFromOffset
// Vec3F offset = TransformUtils.CalcSnapFromOffset(node, snapSettings.SnapFrom);
//
// // Offset by pivot
// Matrix4F P = new Matrix4F();
// P.Translation = offset;
// toworld.Mul(toworld,P);
return toworld;
}
示例4: OnBeginDrag
public override void OnBeginDrag()
{
if (m_hitRegion == HitRegion.None)
return;
var selectionCntx = DesignView.Context.As<ISelectionContext>();
var selection = selectionCntx.Selection;
var transactionContext = DesignView.Context.As<ITransactionContext>();
NodeList.Clear();
IEnumerable<DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable<DomNode>());
foreach (DomNode domNode in rootDomNodes)
{
ITransformable node = domNode.As<ITransformable>();
if (node == null || (node.TransformationType & TransformationTypes.Rotation) == 0)
continue;
IVisible vn = node.As<IVisible>();
if (!vn.Visible) continue;
ILockable lockable = node.As<ILockable>();
if (lockable.IsLocked) continue;
NodeList.Add(node);
IManipulatorNotify notifier = node.As<IManipulatorNotify>();
if (notifier != null) notifier.OnBeginDrag();
}
m_rotations = new Matrix4F[NodeList.Count];
for (int k = 0; k < NodeList.Count; k++)
{
ITransformable node = NodeList[k];
Matrix4F m = new Matrix4F(node.Transform);
m.Translation = new Vec3F(0, 0, 0);
m.Normalize(m);
m_rotations[k] = m;
}
if(NodeList.Count > 0)
transactionContext.Begin("Rotate".Localize());
}
示例5: GetManipulatorMatrix
protected override Matrix4F GetManipulatorMatrix()
{
ITransformable node = GetManipulatorNode(TransformationTypes.Translation);
if (node == null ) return null;
ISnapSettings snapSettings = (ISnapSettings)DesignView;
Path<DomNode> path = new Path<DomNode>(node.Cast<DomNode>().GetPath());
Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1);
Matrix4F toworld = new Matrix4F();
if (snapSettings.ManipulateLocalAxis)
{
toworld.Set(localToWorld);
toworld.Normalize(toworld);
}
else
{
toworld.Translation = localToWorld.Translation;
}
Vec3F offset = TransformUtils.CalcSnapFromOffset(node, snapSettings.SnapFrom);
// Offset by pivot
Matrix4F P = new Matrix4F();
P.Translation = offset;
toworld.Mul(toworld,P);
return toworld;
}