本文整理汇总了C#中MegaShape.CalcLength方法的典型用法代码示例。如果您正苦于以下问题:C# MegaShape.CalcLength方法的具体用法?C# MegaShape.CalcLength怎么用?C# MegaShape.CalcLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MegaShape
的用法示例。
在下文中一共展示了MegaShape.CalcLength方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: importData
public void importData(string svgdata, MegaShape shape, float scale, bool clear, int start)
{
LoadXML(svgdata, shape, clear, start);
for ( int i = start; i < splineindex; i++ )
{
float area = shape.splines[i].Area();
if ( area < 0.0f )
shape.splines[i].reverse = false;
else
shape.splines[i].reverse = true;
}
//shape.Centre(0.01f, new Vector3(-1.0f, 1.0f, 1.0f));
shape.Centre(scale, new Vector3(-1.0f, 1.0f, 1.0f), start);
shape.CalcLength(); //10);
}
示例2: DisplaySpline
void DisplaySpline(MegaShape shape, MegaSpline spline)
{
bool closed = EditorGUILayout.Toggle("Closed", spline.closed);
if ( closed != spline.closed )
{
spline.closed = closed;
shape.CalcLength(); //10);
EditorUtility.SetDirty(target);
//shape.BuildMesh();
}
spline.reverse = EditorGUILayout.Toggle("Reverse", spline.reverse);
EditorGUILayout.LabelField("Length ", spline.length.ToString("0.000"));
spline.twistmode = (MegaShapeEase)EditorGUILayout.EnumPopup("Twist Mode", spline.twistmode);
showknots = EditorGUILayout.Foldout(showknots, "Knots");
if ( showknots )
{
for ( int i = 0; i < spline.knots.Count; i++ )
{
DisplayKnot(shape, spline, spline.knots[i], i);
//EditorGUILayout.Separator();
}
}
}
示例3: DisplayKnot
void DisplayKnot(MegaShape shape, MegaSpline spline, MegaKnot knot, int i)
{
bool recalc = false;
Vector3 p = EditorGUILayout.Vector3Field("Knot [" + i + "] Pos", knot.p);
delta = p - knot.p;
knot.invec += delta;
knot.outvec += delta;
if ( knot.p != p )
{
recalc = true;
knot.p = p;
}
if ( recalc )
{
shape.CalcLength(); //10);
}
knot.twist = EditorGUILayout.FloatField("Twist", knot.twist);
knot.id = EditorGUILayout.IntField("ID", knot.id);
}
示例4: DisplaySpline
void DisplaySpline(MegaShape shape, MegaSpline spline)
{
bool closed = EditorGUILayout.Toggle("Closed", spline.closed);
if ( closed != spline.closed )
{
spline.closed = closed;
shape.CalcLength(); //10);
EditorUtility.SetDirty(target);
//shape.BuildMesh();
}
spline.reverse = EditorGUILayout.Toggle("Reverse", spline.reverse);
EditorGUILayout.LabelField("Length ", spline.length.ToString("0.000"));
//if ( GUILayout.Button("Outline") )
//{
// shape.OutlineSpline(shape, shape.selcurve, outline, true);
// EditorUtility.SetDirty(target);
// buildmesh = true;
//}
showknots = EditorGUILayout.Foldout(showknots, "Knots");
if ( showknots )
{
for ( int i = 0; i < spline.knots.Count; i++ )
{
DisplayKnot(shape, spline, spline.knots[i]);
//EditorGUILayout.Separator();
}
}
}
示例5: DisplayKnot
void DisplayKnot(MegaShape shape, MegaSpline spline, MegaKnot knot)
{
bool recalc = false;
Vector3 p = EditorGUILayout.Vector3Field("Pos", knot.p);
delta = p - knot.p;
knot.invec += delta;
knot.outvec += delta;
if ( knot.p != p )
{
recalc = true;
knot.p = p;
}
if ( recalc )
{
shape.CalcLength(); //10);
}
}
示例6: DisplaySpline
void DisplaySpline(MegaShape shape, MegaSpline spline)
{
bool closed = EditorGUILayout.Toggle("Closed", spline.closed);
if ( closed != spline.closed )
{
spline.closed = closed;
shape.CalcLength(10);
EditorUtility.SetDirty(target);
}
EditorGUILayout.LabelField("Length ", spline.length.ToString("0.000"));
showknots = EditorGUILayout.Foldout(showknots, "Knots");
if ( showknots )
{
for ( int i = 0; i < spline.knots.Count; i++ )
{
DisplayKnot(shape, spline, spline.knots[i]);
//EditorGUILayout.Separator();
}
}
}
示例7: DisplayKnot
void DisplayKnot(MegaShape shape, MegaSpline spline, MegaKnot knot)
{
bool recalc = false;
Vector3 p = EditorGUILayout.Vector3Field("Pos", knot.p);
#if false
Vector3 invec = EditorGUILayout.Vector3Field("In", knot.invec);
//Vector3 outvec = EditorGUILayout.Vector3Field("Out", knot.outvec);
if ( invec != knot.invec )
{
if ( shape.lockhandles )
{
Vector3 d = invec - knot.invec;
knot.outvec -= d;
}
knot.invec = invec;
recalc = true;
}
Vector3 outvec = EditorGUILayout.Vector3Field("Out", knot.outvec);
if ( outvec != knot.outvec )
{
if ( shape.lockhandles )
{
Vector3 d = outvec - knot.outvec;
knot.invec -= d;
}
knot.outvec = outvec;
recalc = true;
}
//Vector3 p = EditorGUILayout.Vector3Field("Pos", knot.p);
#endif
delta = p - knot.p;
knot.invec += delta;
knot.outvec += delta;
if ( knot.p != p )
{
recalc = true;
knot.p = p;
}
if ( recalc )
{
shape.CalcLength(10);
}
}