本文整理汇总了C#中Mesh.ConstPointer方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.ConstPointer方法的具体用法?C# Mesh.ConstPointer怎么用?C# Mesh.ConstPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.ConstPointer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomMeshObject
protected CustomMeshObject(Mesh mesh)
: base(true)
{
Guid type_id = GetType().GUID;
IntPtr pConstMesh = mesh.ConstPointer();
m_pRhinoObject = UnsafeNativeMethods.CRhinoCustomObject_New2(type_id, pConstMesh);
}
示例2: DrawMeshShaded
/// <summary>
/// Draws the shaded faces of a given mesh.
/// </summary>
/// <param name="mesh">Mesh to draw.</param>
/// <param name="material">Material to draw faces with.</param>
/// <param name="faceIndices">Indices of specific faces to draw</param>
public void DrawMeshShaded(Mesh mesh, DisplayMaterial material, int[] faceIndices)
{
IntPtr pMesh = mesh.ConstPointer();
IntPtr pMaterial = IntPtr.Zero;
if (null != material)
pMaterial = material.ConstPointer();
UnsafeNativeMethods.CRhinoDisplayPipeline_DrawShadedMesh2(m_ptr, pMesh, pMaterial, faceIndices.Length, faceIndices);
}
示例3: DrawMeshVertices
/// <summary>
/// Draws all the vertices in a given mesh.
/// </summary>
/// <param name="mesh">Mesh for vertex drawing.</param>
/// <param name="color">Color of mesh vertices.</param>
public void DrawMeshVertices(Mesh mesh, System.Drawing.Color color)
{
int argb = color.ToArgb();
IntPtr pMesh = mesh.ConstPointer();
UnsafeNativeMethods.CRhinoDisplayPipeline_DrawMeshVertices(m_ptr, pMesh, argb);
}
示例4: DrawMeshWires
/// <summary>
/// Draws all the wires in a given mesh.
/// </summary>
/// <param name="mesh">Mesh for wire drawing.</param>
/// <param name="color">Color of mesh wires.</param>
/// <param name="thickness">Thickness (in pixels) of mesh wires.</param>
public void DrawMeshWires(Mesh mesh, System.Drawing.Color color, int thickness)
{
if (thickness > 0)
{
int argb = color.ToArgb();
IntPtr pMesh = mesh.ConstPointer();
UnsafeNativeMethods.CRhinoDisplayPipeline_DrawMeshWires(m_ptr, pMesh, argb, thickness);
}
}
示例5: Compute
/// <summary>
/// Compute the VolumeMassProperties for a single Mesh.
/// </summary>
/// <param name="mesh">Mesh to measure.</param>
/// <returns>The VolumeMassProperties for the given Mesh or null on failure.</returns>
/// <exception cref="System.ArgumentNullException">When mesh is null.</exception>
public static VolumeMassProperties Compute(Mesh mesh)
{
if (mesh == null)
throw new ArgumentNullException("mesh");
IntPtr pMesh = mesh.ConstPointer();
IntPtr rc = UnsafeNativeMethods.ON_Mesh_MassProperties(false, pMesh);
if (IntPtr.Zero == rc)
return null;
return new VolumeMassProperties(rc, false);
}
示例6: MeshLine
/// <summary>
/// Finds the intersection of a mesh and a line
/// </summary>
/// <param name="mesh">A mesh to intersect</param>
/// <param name="line">The line to intersect with the mesh</param>
/// <param name="faceIds">The indices of the intersecting faces. This out reference is assigned during the call.</param>
/// <returns>An array of points: one for each face that was passed by the faceIds out reference.</returns>
public static Point3d[] MeshLine(Mesh mesh, Line line, out int[] faceIds)
{
faceIds = null;
IntPtr pConstMesh = mesh.ConstPointer();
int count = 0;
IntPtr rc = UnsafeNativeMethods.ON_Intersect_MeshLine(pConstMesh, line.From, line.To, ref count);
if (0 == count || IntPtr.Zero == rc)
return new Point3d[0];
Point3d[] points = new Point3d[count];
faceIds = new int[count];
UnsafeNativeMethods.ON_Intersect_MeshPolyline_Fill(rc, count, points, faceIds);
return points;
}
示例7: MeshRay
/// <summary>Finds the first intersection of a ray with a mesh.</summary>
/// <param name="mesh">A mesh to intersect.</param>
/// <param name="ray">A ray to be casted.</param>
/// <param name="meshFaceIndices">faces on mesh that ray intersects.</param>
/// <returns>
/// >= 0.0 parameter along ray if successful.
/// < 0.0 if no intersection found.
/// </returns>
/// <remarks>
/// The ray may intersect more than one face in cases where the ray hits
/// the edge between two faces or the vertex corner shared by multiple faces.
/// </remarks>
public static double MeshRay(Mesh mesh, Ray3d ray, out int[] meshFaceIndices)
{
meshFaceIndices = null;
using (Runtime.InteropWrappers.SimpleArrayInt indices = new Rhino.Runtime.InteropWrappers.SimpleArrayInt())
{
IntPtr pConstMesh = mesh.ConstPointer();
double rc = UnsafeNativeMethods.ON_Intersect_MeshRay1(pConstMesh, ref ray, indices.m_ptr );
int[] vals = indices.ToArray();
if (vals!=null && vals.Length > 0)
meshFaceIndices = vals;
return rc;
}
}
示例8: MeshPolyline
/// <summary>
/// Finds the intersection of a mesh and a polyline.
/// </summary>
/// <param name="mesh">A mesh to intersect.</param>
/// <param name="curve">A polyline curves to intersect.</param>
/// <param name="faceIds">The indices of the intersecting faces. This out reference is assigned during the call.</param>
/// <returns>An array of points: one for each face that was passed by the faceIds out reference.</returns>
public static Point3d[] MeshPolyline(Mesh mesh, PolylineCurve curve, out int[] faceIds)
{
faceIds = null;
IntPtr pConstMesh = mesh.ConstPointer();
IntPtr pConstCurve = curve.ConstPointer();
int count = 0;
IntPtr rc = UnsafeNativeMethods.ON_Intersect_MeshPolyline1(pConstMesh, pConstCurve, ref count);
if (0 == count || IntPtr.Zero == rc)
return null;
Point3d[] points = new Point3d[count];
faceIds = new int[count];
UnsafeNativeMethods.ON_Intersect_MeshPolyline_Fill(rc, count, points, faceIds);
return points;
}
示例9: MeshMeshAccurate
/// <summary>
/// Intersects two meshes. Overlaps and near misses are handled.
/// </summary>
/// <param name="meshA">First mesh for intersection.</param>
/// <param name="meshB">Second mesh for intersection.</param>
/// <param name="tolerance">Intersection tolerance.</param>
/// <returns>An array of intersection polylines.</returns>
public static Polyline[] MeshMeshAccurate(Mesh meshA, Mesh meshB, double tolerance)
{
IntPtr pMeshA = meshA.ConstPointer();
IntPtr pMeshB = meshB.ConstPointer();
int polylines_created = 0;
IntPtr pPolys = UnsafeNativeMethods.ON_Intersect_MeshMesh1(pMeshA, pMeshB, ref polylines_created, tolerance);
if (polylines_created < 1 || IntPtr.Zero == pPolys)
return null;
// convert the C++ polylines created into .NET polylines. We can reuse the meshplane functions
Polyline[] rc = new Polyline[polylines_created];
for (int i = 0; i < polylines_created; i++)
{
int point_count = UnsafeNativeMethods.ON_Intersect_MeshPlanes2(pPolys, i);
Polyline pl = new Polyline(point_count);
if (point_count > 0)
{
pl.m_size = point_count;
UnsafeNativeMethods.ON_Intersect_MeshPlanes3(pPolys, i, point_count, pl.m_items);
}
rc[i] = pl;
}
UnsafeNativeMethods.ON_Intersect_MeshPlanes4(pPolys);
return rc;
}
示例10: MeshMeshFast
/// <summary>
/// Quickly intersects two meshes. Overlaps and near misses are ignored.
/// </summary>
/// <param name="meshA">First mesh for intersection.</param>
/// <param name="meshB">Second mesh for intersection.</param>
/// <returns>An array of intersection line segments.</returns>
public static Line[] MeshMeshFast(Mesh meshA, Mesh meshB)
{
IntPtr ptrA = meshA.ConstPointer();
IntPtr ptrB = meshB.ConstPointer();
Line[] intersectionLines = new Line[0];
using (Runtime.InteropWrappers.SimpleArrayLine arr = new Runtime.InteropWrappers.SimpleArrayLine())
{
IntPtr pLines = arr.NonConstPointer();
int rc = UnsafeNativeMethods.ON_Mesh_IntersectMesh(ptrA, ptrB, pLines);
if (rc > 0)
intersectionLines = arr.ToArray();
}
return intersectionLines;
}
示例11: MeshPlane
/// <summary>
/// Intersects a mesh with a collection of (infinite) planes.
/// </summary>
/// <param name="mesh">Mesh to intersect.</param>
/// <param name="planes">Planes to intersect with.</param>
/// <returns>An array of polylines describing the intersection loops or null (Nothing in Visual Basic) if no intersections could be found.</returns>
/// <exception cref="ArgumentNullException">If planes is null.</exception>
public static Polyline[] MeshPlane(Mesh mesh, IEnumerable<Plane> planes)
{
if (planes == null) throw new ArgumentNullException("planes");
Rhino.Collections.RhinoList<Plane> list = planes as Rhino.Collections.RhinoList<Plane> ??
new Rhino.Collections.RhinoList<Plane>(planes);
if (list.Count < 1)
return null;
IntPtr pMesh = mesh.ConstPointer();
int polylines_created = 0;
IntPtr pPolys = UnsafeNativeMethods.TL_Intersect_MeshPlanes1(pMesh, list.Count, list.m_items, ref polylines_created);
if (polylines_created < 1 || IntPtr.Zero == pPolys)
return null;
// convert the C++ polylines created into .NET polylines
Polyline[] rc = new Polyline[polylines_created];
for (int i = 0; i < polylines_created; i++)
{
int point_count = UnsafeNativeMethods.ON_Intersect_MeshPlanes2(pPolys, i);
Polyline pl = new Polyline(point_count);
if (point_count > 0)
{
pl.m_size = point_count;
UnsafeNativeMethods.ON_Intersect_MeshPlanes3(pPolys, i, point_count, pl.m_items);
}
rc[i] = pl;
}
UnsafeNativeMethods.ON_Intersect_MeshPlanes4(pPolys);
return rc;
}
示例12: CustomMeshObject
protected CustomMeshObject(Mesh mesh)
: base(true)
{
IntPtr pConstMesh = mesh.ConstPointer();
m_pRhinoObject = UnsafeNativeMethods.CRhinoCustomObject_New2(pConstMesh);
}
示例13: CreateMeshFaceTree
/// <summary>
/// Constructs a new tree with an element for each face in the mesh.
/// The element id is set to the index of the face.
/// </summary>
/// <param name="mesh">A mesh.</param>
/// <returns>A new tree, or null on error.</returns>
public static RTree CreateMeshFaceTree(Mesh mesh)
{
RTree rc = new RTree();
IntPtr pRtree = rc.NonConstPointer();
IntPtr pConstMesh = mesh.ConstPointer();
if (!UnsafeNativeMethods.ON_RTree_CreateMeshFaceTree(pRtree, pConstMesh))
{
rc.Dispose();
return null;
}
uint size = UnsafeNativeMethods.ON_RTree_SizeOf(pRtree);
rc.m_memory_pressure = size;
GC.AddMemoryPressure(rc.m_memory_pressure);
return rc;
}
示例14: Add
/// <summary>
/// Add mesh and material.
/// </summary>
/// <param name="mesh">Mesh to add.</param>
/// <param name="material">
/// Material to add, may be null if not needed.
/// </param>
public void Add(Mesh mesh, RenderMaterial material)
{
var material_pointer = (null == material ? IntPtr.Zero : material.ConstPointer());
var pointer = NonConstPointer();
UnsafeNativeMethods.Rdk_CustomMeshes_AddMesh(pointer, mesh.ConstPointer(), material_pointer);
}
示例15: DrawMeshFalseColors
/// <summary>
/// Draws the mesh faces as false color patches.
/// The mesh must have Vertex Colors defined for this to work.
/// </summary>
/// <param name="mesh">Mesh to draw.</param>
public void DrawMeshFalseColors(Mesh mesh)
{
IntPtr pMesh = mesh.ConstPointer();
UnsafeNativeMethods.CRhinoDisplayPipeline_DrawMeshFalseColors(m_ptr, pMesh, false);
}