本文整理汇总了C#中Mesh.Box方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.Box方法的具体用法?C# Mesh.Box怎么用?C# Mesh.Box使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.Box方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Waffle
protected Waffle(Mesh mesh, Plane plane, double thickness, double deeper, int countX, int countY, double unit, bool project, double projectSpace)
{
var box = mesh.Box(plane);
var unitX = box.Plane.XAxis;
var unitY = box.Plane.YAxis;
var unitZ = box.Plane.ZAxis;
var origin = box.PointAt(0.0, 0.0, 0.0);
var lenX = Math.Abs(box.X.Length);
var lenY = Math.Abs(box.Y.Length);
var lenZ = Math.Abs(box.Z.Length);
var valX = Enumerable.Range(1, countX).Select(o => o * lenX / (countX + 1));
var vecX = valX.Select(o => o * unitX).ToArray();
var plnX = vecX.Select(o => new Plane(origin + o, unitY, unitZ)).ToArray();
var sltX = plnX.Select(o => new SlitPlane(mesh, o, unit)).ToArray();
var valY = Enumerable.Range(1, countY).Select(o => o * lenY / (countY + 1));
var vecY = valY.Select(o => o * unitY).ToArray();
var plnY = vecY.Select(o => new Plane(origin + o, unitX, unitZ)).ToArray();
var sltY = plnY.Select(o => new SlitPlane(mesh, o, unit)).ToArray();
for (var i = 0; i < sltX.Length; i++)
{
for (var j = 0; j < sltY.Length; j++)
{
var p0 = origin + vecX[i] + vecY[j];
var p1 = p0 + lenZ * unitZ;
sltX[i].AddSlit(p0, p1, thickness, deeper);
sltY[j].AddSlit(p1, p0, thickness, deeper);
}
}
CurvesX = sltX.Select(o => o.GetResult()).ToArray();
CurvesY = sltY.Select(o => o.GetResult()).ToArray();
PlanesX = plnX;
PlanesY = plnY;
if (!project)
return;
for (var i = 0; i < CurvesX.Length; i++)
{
Project(CurvesX[i], PlanesX[i], i * (lenY + projectSpace), 0.0);
}
for (var i = 0; i < CurvesY.Length; i++)
{
Project(CurvesY[i], PlanesY[i], i * (lenX + projectSpace), lenZ + projectSpace);
}
}
示例2: Radial
protected Radial(Mesh mesh, Plane plane, double thickness, double deeper, double radius, int countA, int countZ, double unit, bool project, double projectSpace)
{
var box = mesh.Box(plane);
var unitX = box.Plane.XAxis;
var unitY = box.Plane.YAxis;
var unitZ = box.Plane.ZAxis;
var center = box.Plane.Origin + box.Z.Min * unitZ;
var corners = box.GetCorners();
var r1 = Math.Max(radius, thickness / 2.0 / Math.Tan(Math.PI / countA));
var r2 = Enumerable.Range(0, 4).Select(i => corners[i].DistanceTo(center)).Max();
var lenX = Math.Abs(box.X.Length);
var lenZ = Math.Abs(box.Z.Length);
var lenR = r2 - r1;
var valA = Enumerable.Range(0, countA).Select(o => Math.PI * 2.0 / countA * o);
var rayA = valA.Select(o => unitX * Math.Cos(o) + unitY * Math.Sin(o)).ToArray();
var plnA = rayA.Select(o => new Plane(center + o * r1, o, unitZ)).ToArray();
var sltA = plnA.Select(o => new SlitPlane(mesh, o, unit)).ToArray();
var valZ = Enumerable.Range(1, countZ).Select(o => o * lenZ / (countZ + 1)).ToArray();
var pntZ = valZ.Select(o => corners[0] + o * unitZ).ToArray();
var plnZ = pntZ.Select(o => new Plane(o, unitX, unitY)).ToArray();
var sltZ = plnZ.Select(o => new SlitPlane(mesh, o, unit)).ToArray();
for (var i = 0; i < sltA.Length; i++)
{
sltA[i].Clip(-unit, (lenR) + unit, -unit, lenZ + unit);
for (var j = 0; j < sltZ.Length; j++)
{
var c = center + valZ[j] * unitZ;
var p0 = c + rayA[i] * (r1 - unit);
var p1 = c + rayA[i] * r2;
sltA[i].AddSlit(p0, p1, thickness, deeper);
sltZ[j].AddSlit(p1, p0, thickness, deeper);
}
}
CurvesA = sltA.Select(o => o.GetResult()).ToArray();
CurvesZ = sltZ.Select(o => o.GetResult()).ToArray();
PlanesA = plnA;
PlanesZ = plnZ;
if (!project)
return;
for (var i = 0; i < CurvesA.Length; i++)
{
Project(CurvesA[i], PlanesA[i], i * (lenR + projectSpace), 0);
}
for (var i = 0; i < CurvesZ.Length; i++)
{
Project(CurvesZ[i], PlanesZ[i], i * (lenX + projectSpace), lenZ + projectSpace);
}
}