本文整理汇总了C#中Plane.RemapToPlaneSpace方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.RemapToPlaneSpace方法的具体用法?C# Plane.RemapToPlaneSpace怎么用?C# Plane.RemapToPlaneSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane.RemapToPlaneSpace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Box
/// <summary>
/// Initializes the smallest box that contains a set of points.
/// </summary>
/// <param name="basePlane">Orientation of the box.</param>
/// <param name="points">Points to include, Invalid points will be ignored.</param>
public Box(Plane basePlane, IEnumerable<Point3d> points)
{
// David: this code is untested.
m_dx = new Interval(+1, -1);
m_dy = new Interval(0, 0);
m_dz = new Interval(0, 0);
m_plane = basePlane;
if (!m_plane.IsValid) { return; }
if (points == null) { return; }
double x0 = double.MaxValue;
double x1 = double.MinValue;
double y0 = double.MaxValue;
double y1 = double.MinValue;
double z0 = double.MaxValue;
double z1 = double.MinValue;
int N = 0;
foreach (Point3d pt in points)
{
if (!pt.IsValid) { continue; }
N++;
Point3d pt_mapped;
m_plane.RemapToPlaneSpace(pt, out pt_mapped);
x0 = Math.Min(x0, pt_mapped.m_x);
x1 = Math.Max(x1, pt_mapped.m_x);
y0 = Math.Min(y0, pt_mapped.m_y);
y1 = Math.Max(y1, pt_mapped.m_y);
z0 = Math.Min(z0, pt_mapped.m_z);
z1 = Math.Max(z1, pt_mapped.m_z);
}
if (N == 0) { return; }
m_dx = new Interval(x0, x1);
m_dy = new Interval(y0, y1);
m_dz = new Interval(z0, z1);
MakeValid();
}
示例2: GetBox
/// <summary>
/// Asks the user to select a Box in the viewport.
/// </summary>
/// <param name="box">If the result is Success, this parameter will be filled out.</param>
/// <param name="mode">A particular "get box" mode, or <see cref="GetBoxMode.All"/>.</param>
/// <param name="basePoint">Optional base point. Supply Point3d.Unset if you don't want to use this.</param>
/// <param name="prompt1">Optional first prompt. Supply null to use the default prompt.</param>
/// <param name="prompt2">Optional second prompt. Supply null to use the default prompt.</param>
/// <param name="prompt3">Optional third prompt. Supply null to use the default prompt.</param>
/// <returns>Commands.Result.Success if successful.</returns>
public static Commands.Result GetBox(out Rhino.Geometry.Box box, GetBoxMode mode, Point3d basePoint, string prompt1, string prompt2, string prompt3)
{
Point3d[] corners = new Point3d[8];
// 19 Feb 2010 S. Baer
// On Win x64 builds the .NET framework appears to have problems if you don't initialize the array
// before passing it off to unmanaged code.
for (int i = 0; i < corners.Length; i++)
corners[i] = new Point3d();
Rhino.Commands.Result rc = (Rhino.Commands.Result)UnsafeNativeMethods.RHC_RhinoGetBox(corners, (int)mode, basePoint, prompt1, prompt2, prompt3);
// David: This code is untested.
box = new Box();
if (rc == Rhino.Commands.Result.Success)
{
Vector3d x = corners[1] - corners[0];
Vector3d y = corners[3] - corners[0];
Vector3d z = corners[4] - corners[0];
// Create a singular box.
if (x.IsZero && y.IsZero && z.IsZero)
{
box = new Box(new Plane(corners[0], new Vector3d(0, 0, 1)), new Interval(), new Interval(), new Interval());
return rc;
}
// Create a linear box.
if (x.IsZero && y.IsZero)
{
box = new Box(new Plane(corners[0], z), new Interval(), new Interval(), new Interval(0, z.Length));
return rc;
}
// Boxes were getting inverted if the "height" pick was on the negative side of the base plane.
Plane base_plane = new Plane(corners[0], x, y);
Point3d C0, C1;
base_plane.RemapToPlaneSpace(corners[0], out C0);
base_plane.RemapToPlaneSpace(corners[6], out C1);
Interval ix = new Interval(C0.X, C1.X); ix.MakeIncreasing();
Interval iy = new Interval(C0.Y, C1.Y); iy.MakeIncreasing();
Interval iz = new Interval(C0.Z, C1.Z); iz.MakeIncreasing();
box = new Box(base_plane, ix, iy, iz);
}
return rc;
}