本文整理汇总了C#中Canguro.GetLine方法的典型用法代码示例。如果您正苦于以下问题:C# Canguro.GetLine方法的具体用法?C# Canguro.GetLine怎么用?C# Canguro.GetLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canguro
的用法示例。
在下文中一共展示了Canguro.GetLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public override void Run(Canguro.Controller.CommandServices services)
{
services.StoreSelection();
LineElement line = services.GetLine();
List<LinkedList<LineElement>> graph = GetLineGraph(services.Model);
ItemList<Joint> joints = services.Model.JointList;
int numJoints = joints.Count;
bool[] colors = new bool[numJoints];
Stack<LineElement> stack = new Stack<LineElement>();
stack.Push(line);
while (stack.Count > 0)
{
line = stack.Pop();
line.IsSelected = true;
if (!colors[line.I.Id])
{
line.I.IsSelected = true;
visit(graph, (int)line.I.Id, stack, line);
colors[line.I.Id] = true;
}
if (!colors[line.J.Id])
{
line.J.IsSelected = true;
visit(graph, (int)line.J.Id, stack, line);
colors[line.J.Id] = true;
}
}
services.RestoreSelection();
services.Model.ChangeSelection(null);
}
示例2: Run
/// <summary>
/// Executes the command.
/// Gets a number of segments and divides all selected line elements in equal length segments.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
List<Item> selection = services.GetSelection();
if (selection.Count == 0)
return;
List<LineElement> lineList = new List<LineElement>();
foreach (Item item in selection)
if (item != null && item is LineElement)
lineList.Add((LineElement)item);
if (lineList.Count == 0)
lineList.Add(services.GetLine());
int parts = (int)services.GetSingle(Culture.Get("getSplitParts") + " [2-100]");
parts = (parts < 2) ? 2 : (parts > 100) ? 100 : parts;
foreach (LineElement line in lineList)
{
Joint ji = line.I;
Joint jj = line.J;
Joint last = jj;
Microsoft.DirectX.Vector3 v = new Microsoft.DirectX.Vector3(jj.X - ji.X, jj.Y - ji.Y, jj.Z - ji.Z);
v.Multiply(1.0f / parts);
if (parts > 1 && v.LengthSq() > 0)
{
LineElement newLine = line;
for (int i = 0; i < parts - 1; i++)
{
jj = new Joint(ji.X + v.X, ji.Y + v.Y, ji.Z + v.Z);
services.Model.JointList.Add(jj);
newLine = Split(newLine, jj, services.Model);
services.Model.LineList.Add(newLine);
ji = jj;
}
}
}
}