public void TestGetPath() { DomNodeType type = new DomNodeType("type"); ChildInfo childInfo = new ChildInfo("child", type, true); type.Define(childInfo); DomNode child = new DomNode(type); DomNode parent = new DomNode(type); DomNode grandparent = new DomNode(type); parent.GetChildList(childInfo).Add(child); grandparent.GetChildList(childInfo).Add(parent); Utilities.TestSequenceEqual(child.GetPath(), grandparent, parent, child); Utilities.TestSequenceEqual(parent.GetPath(), grandparent, parent); Utilities.TestSequenceEqual(grandparent.GetPath(), grandparent); }
public IControlPoint InsertPoint(uint index, float x, float y, float z) { IControlPoint cpt = CreateControlPoint(); int numSteps = GetAttribute <int>(Schema.curveType.stepsAttribute); int interpolationType = GetAttribute <int>(Schema.curveType.interpolationTypeAttribute); if (interpolationType != 0 && numSteps > 0) { index = index / (uint)numSteps; } Path <DomNode> path = new Path <DomNode>(DomNode.GetPath()); Matrix4F toworld = TransformUtils.CalcPathTransform(path, path.Count - 1); Matrix4F worldToLocal = new Matrix4F(); worldToLocal.Invert(toworld); Vec3F pos = new Vec3F(x, y, z); worldToLocal.Transform(ref pos); cpt.Translation = pos; ControlPoints.Insert((int)index + 1, cpt); return(cpt); }