本文整理汇总了C#中Rhino.Geometry.Curve.ConstPointer方法的典型用法代码示例。如果您正苦于以下问题:C# Curve.ConstPointer方法的具体用法?C# Curve.ConstPointer怎么用?C# Curve.ConstPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Geometry.Curve
的用法示例。
在下文中一共展示了Curve.ConstPointer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Constructs a new surface of revolution from a generatrix curve and an axis.
/// <para>This overload accepts a slice start and end angles.</para>
/// </summary>
/// <param name="revoluteCurve">A generatrix.</param>
/// <param name="axisOfRevolution">An axis.</param>
/// <param name="startAngleRadians">An angle in radias for the start.</param>
/// <param name="endAngleRadians">An angle in radias for the end.</param>
/// <returns>A new surface of revolution, or null if any of the inputs is invalid or on error.</returns>
public static RevSurface Create(Curve revoluteCurve, Line axisOfRevolution, double startAngleRadians, double endAngleRadians)
{
IntPtr pConstCurve = revoluteCurve.ConstPointer();
IntPtr pRevSurface = UnsafeNativeMethods.ON_RevSurface_Create(pConstCurve, ref axisOfRevolution, startAngleRadians, endAngleRadians);
if (IntPtr.Zero == pRevSurface)
return null;
return new RevSurface(pRevSurface, null);
}
示例2: Create
/// <summary>
/// Constructs a new sum surface by extruding a curve A along a path B.
/// </summary>
/// <param name="curveA">The curve used as extrusion profile.</param>
/// <param name="curveB">The curve used as path.</param>
/// <returns>A new sum surface on success; null on failure.</returns>
public static SumSurface Create(Curve curveA, Curve curveB)
{
IntPtr pConstCurveA = curveA.ConstPointer();
IntPtr pConstCurveB = curveB.ConstPointer();
IntPtr pSumSurface = UnsafeNativeMethods.ON_SumSurface_Create(pConstCurveA, pConstCurveB);
if (IntPtr.Zero == pSumSurface)
return null;
return new SumSurface(pSumSurface, null);
}
示例3: TryFitCircleTT
/// <summary>
/// Try to fit a circle to two curves using tangent relationships.
/// </summary>
/// <param name="c1">First curve to touch.</param>
/// <param name="c2">Second curve to touch.</param>
/// <param name="t1">Parameter on first curve close to desired solution.</param>
/// <param name="t2">Parameter on second curve closet to desired solution.</param>
/// <returns>Valid circle on success, Circle.Unset on failure.</returns>
public static Circle TryFitCircleTT(Curve c1, Curve c2, double t1, double t2)
{
if (c1 == null) { throw new ArgumentNullException("c1"); }
if (c2 == null) { throw new ArgumentNullException("c2"); }
if (!RhinoMath.IsValidDouble(t1)) { throw new ArgumentNullException("t1"); }
if (!RhinoMath.IsValidDouble(t2)) { throw new ArgumentNullException("t2"); }
Circle rc = Circle.Unset;
if (!UnsafeNativeMethods.ON_Circle_TryFitTT(c1.ConstPointer(), c2.ConstPointer(), t1, t2, ref rc))
rc = Circle.Unset;
return rc;
}
示例4: CreateCubicBeziers
/// <summary>
/// Constructs an array of cubic, non-rational beziers that fit a curve to a tolerance.
/// </summary>
/// <param name="sourceCurve">A curve to approximate.</param>
/// <param name="distanceTolerance">
/// The max fitting error. Use RhinoMath.SqrtEpsilon as a minimum.
/// </param>
/// <param name="kinkTolerance">
/// If the input curve has a g1-discontinuity with angle radian measure
/// greater than kinkTolerance at some point P, the list of beziers will
/// also have a kink at P.
/// </param>
/// <returns>A new array of bezier curves. The array can be empty and might contain null items.</returns>
public static BezierCurve[] CreateCubicBeziers(Curve sourceCurve, double distanceTolerance, double kinkTolerance)
{
IntPtr pConstCurve = sourceCurve.ConstPointer();
IntPtr pBezArray = UnsafeNativeMethods.ON_SimpleArray_BezierCurveNew();
int count = UnsafeNativeMethods.RHC_RhinoMakeCubicBeziers(pConstCurve, pBezArray, distanceTolerance, kinkTolerance);
BezierCurve[] rc = new BezierCurve[count];
for (int i = 0; i < count; i++)
{
IntPtr ptr = UnsafeNativeMethods.ON_SimpleArray_BezierCurvePtr(pBezArray, i);
if (ptr != IntPtr.Zero)
rc[i] = new BezierCurve(ptr);
}
UnsafeNativeMethods.ON_SimpleArray_BezierCurveDelete(pBezArray);
return rc;
}
示例5: Construct
IntPtr m_ptr; //CArgsRhinoSweep2*
public static ArgsSweep2 Construct(Curve rail1, Curve rail2, IEnumerable<Curve> crossSections,
IEnumerable<double> crossSectionParameters1, IEnumerable<double> crossSectionParameters2,
bool closed, double sweep_tol, double angle_tol, bool maintain_height)
{
ArgsSweep2 rc = new ArgsSweep2();
List<Curve> xsec = new List<Curve>(crossSections);
List<double> xsec_t1 = new List<double>(crossSectionParameters1);
List<double> xsec_t2 = new List<double>(crossSectionParameters2);
if (xsec.Count < 1)
throw new ArgumentException("must have at least one cross section");
if (xsec.Count != xsec_t1.Count || xsec.Count != xsec_t2.Count)
throw new ArgumentException("must have same number of elements in crossSections and crossSectionParameters");
IntPtr pConstRail1 = rail1.ConstPointer();
IntPtr pConstRail2 = rail2.ConstPointer();
using (var sections = new Rhino.Runtime.InteropWrappers.SimpleArrayCurvePointer(crossSections))
{
IntPtr pSections = sections.ConstPointer();
double[] tvals1 = xsec_t1.ToArray();
double[] tvals2 = xsec_t2.ToArray();
rc.m_ptr = UnsafeNativeMethods.CArgsRhinoSweep2_New(pConstRail1, pConstRail2, pSections, tvals1, tvals2, closed, sweep_tol, angle_tol, maintain_height);
}
return rc;
}
示例6: CreateExtrusionToPoint
/// <summary>
/// Constructs a surface by extruding a curve to a point.
/// </summary>
/// <param name="profile">Profile curve to extrude.</param>
/// <param name="apexPoint">Apex point of extrusion.</param>
/// <returns>A Surface on success or null on failure.</returns>
public static Surface CreateExtrusionToPoint(Curve profile, Point3d apexPoint)
{
IntPtr pConstCurve = profile.ConstPointer();
IntPtr pSurface = UnsafeNativeMethods.RHC_RhinoExtrudeCurveToPoint(pConstCurve, apexPoint);
if (IntPtr.Zero == pSurface)
return null;
// CreateGeometryHelper will create the "actual" surface type (Nurbs, Sum, Rev,...)
GeometryBase g = GeometryBase.CreateGeometryHelper(pSurface, null);
Surface rc = g as Surface;
return rc;
}
示例7: ProjectToBrep
/// <summary>
/// Projects a Curve onto a Brep along a given direction.
/// </summary>
/// <param name="curve">Curve to project.</param>
/// <param name="brep">Brep to project onto.</param>
/// <param name="direction">Direction of projection.</param>
/// <param name="tolerance">Tolerance to use for projection.</param>
/// <returns>An array of projected curves or empty array if the projection set is empty.</returns>
public static Curve[] ProjectToBrep(Curve curve, Brep brep, Vector3d direction, double tolerance)
{
IntPtr brep_ptr = brep.ConstPointer();
IntPtr curve_ptr = curve.ConstPointer();
using (SimpleArrayCurvePointer rc = new SimpleArrayCurvePointer())
{
IntPtr rc_ptr = rc.NonConstPointer();
return UnsafeNativeMethods.RHC_RhinoProjectCurveToBrep(brep_ptr, curve_ptr, direction, tolerance, rc_ptr) ? rc.ToNonConstArray() : new Curve[0];
}
}
示例8: GetFilletPoints
/// <summary>
/// Finds points at which to cut a pair of curves so that a fillet of given radius can be inserted.
/// </summary>
/// <param name="curve0">First curve to fillet.</param>
/// <param name="curve1">Second curve to fillet.</param>
/// <param name="radius">Fillet radius.</param>
/// <param name="t0Base">Parameter value for base point on curve0.</param>
/// <param name="t1Base">Parameter value for base point on curve1.</param>
/// <param name="t0">Parameter value of fillet point on curve 0.</param>
/// <param name="t1">Parameter value of fillet point on curve 1.</param>
/// <param name="filletPlane">
/// The fillet is contained in this plane with the fillet center at the plane origin.
/// </param>
/// <returns>true on success, false on failure.</returns>
/// <remarks>
/// A fillet point is a pair of curve parameters (t0,t1) such that there is a circle
/// of radius point3 tangent to curve c0 at t0 and tangent to curve c1 at t1. Of all possible
/// fillet points this function returns the one which is the closest to the base point
/// t0Base, t1Base. Distance from the base point is measured by the sum of arc lengths
/// along the two curves.
/// </remarks>
public static bool GetFilletPoints(Curve curve0, Curve curve1, double radius, double t0Base, double t1Base,
out double t0, out double t1, out Plane filletPlane)
{
t0 = 0;
t1 = 0;
filletPlane = new Plane();
if (null == curve0 || null == curve1)
return false;
IntPtr pCurve0 = curve0.ConstPointer();
IntPtr pCurve1 = curve1.ConstPointer();
bool rc = UnsafeNativeMethods.RHC_GetFilletPoints(pCurve0, pCurve1, radius, t0Base, t1Base, ref t0, ref t1, ref filletPlane);
return rc;
}
示例9: CreateBlendCurve
/// <summary>
/// Makes a curve blend between 2 curves at the parameters specified
/// with the directions and continuities specified
/// </summary>
/// <param name="curve0">First curve to blend from</param>
/// <param name="t0">Parameter on first curve for blend endpoint</param>
/// <param name="reverse0">
/// If false, the blend will go in the natural direction of the curve.
/// If true, the blend will go in the opposite direction to the curve
/// </param>
/// <param name="continuity0">continuity for the blend at the start</param>
/// <param name="curve1">Second curve to blend from</param>
/// <param name="t1">Parameter on second curve for blend endpoint</param>
/// <param name="reverse1">
/// If false, the blend will go in the natural direction of the curve.
/// If true, the blend will go in the opposite direction to the curve
/// </param>
/// <param name="continuity1">continuity for the blend at the end</param>
/// <returns>the blend curve on success. null on failure</returns>
public static Curve CreateBlendCurve(Curve curve0, double t0, bool reverse0, BlendContinuity continuity0,
Curve curve1, double t1, bool reverse1, BlendContinuity continuity1)
{
IntPtr pConstCurve0 = curve0.ConstPointer();
IntPtr pConstCurve1 = curve1.ConstPointer();
IntPtr pCurve = UnsafeNativeMethods.CRhinoBlend_CurveBlend(pConstCurve0, t0, reverse0, (int)continuity0, pConstCurve1, t1, reverse1, (int)continuity1);
return GeometryBase.CreateGeometryHelper(pCurve, null) as Curve;
}
示例10: CreateMeanCurve
/// <summary>
/// Constructs a mean, or average, curve from two curves.
/// </summary>
/// <param name="curveA">A first curve.</param>
/// <param name="curveB">A second curve.</param>
/// <param name="angleToleranceRadians">
/// The angle tolerance, in radians, used to match kinks between curves.
/// If you are unsure how to set this parameter, then either use the
/// document's angle tolerance RhinoDoc.AngleToleranceRadians,
/// or the default value (RhinoMath.UnsetValue)
/// </param>
/// <returns>The average curve, or null on error.</returns>
/// <exception cref="ArgumentNullException">If curveA or curveB are null.</exception>
public static Curve CreateMeanCurve(Curve curveA, Curve curveB, double angleToleranceRadians)
{
if (curveA == null) throw new ArgumentNullException("curveA");
if (curveB == null) throw new ArgumentNullException("curveB");
IntPtr pCurveA = curveA.ConstPointer();
IntPtr pCurveB = curveB.ConstPointer();
IntPtr pNewCurve = UnsafeNativeMethods.RHC_RhinoMeanCurve(pCurveA, pCurveB, angleToleranceRadians);
return GeometryBase.CreateGeometryHelper(pNewCurve, null) as Curve;
}
示例11: PlanarClosedCurveRelationship
/// <summary>
/// Determines whether two coplanar simple closed curves are disjoint or intersect;
/// otherwise, if the regions have a containment relationship, discovers
/// which curve encloses the other.
/// </summary>
/// <param name="curveA">A first curve.</param>
/// <param name="curveB">A second curve.</param>
/// <param name="testPlane">A plane.</param>
/// <param name="tolerance">A tolerance value.</param>
/// <returns>
/// A value indicating the relationship between the first and the second curve.
/// </returns>
public static RegionContainment PlanarClosedCurveRelationship(Curve curveA, Curve curveB, Plane testPlane, double tolerance)
{
IntPtr pConstCurveA = curveA.ConstPointer();
IntPtr pConstCurveB = curveB.ConstPointer();
return (RegionContainment)UnsafeNativeMethods.RHC_RhinoPlanarClosedCurveContainmentTest(pConstCurveA, pConstCurveB, ref testPlane, tolerance);
}
示例12: CustomCurveObject
protected CustomCurveObject(Curve curve) : base()
{
Guid type_id = GetType().GUID;
IntPtr pConstCurve = curve.ConstPointer();
m_pRhinoObject = UnsafeNativeMethods.CRhinoCustomObject_New2(type_id, pConstCurve);
}
示例13: CreateFilletCurves
/// <summary>
/// Creates a tangent arc between two curves and trims or extends the curves to the arc.
/// </summary>
/// <param name="curve0">The first curve to fillet.</param>
/// <param name="point0">
/// A point on the first curve that is near the end where the fillet will
/// be created.
/// </param>
/// <param name="curve1">The second curve to fillet.</param>
/// <param name="point1">
/// A point on the second curve that is near the end where the fillet will
/// be created.
/// </param>
/// <param name="radius">The radius of the fillet.</param>
/// <param name="join">Join the output curves.</param>
/// <param name="trim">
/// Trim copies of the input curves to the output fillet curve.
/// </param>
/// <param name="arcExtension">
/// Applies when arcs are filleted but need to be extended to meet the
/// fillet curve or chamfer line. If true, then the arc is extended
/// maintaining its validity. If false, then the arc is extended with a
/// line segment, which is joined to the arc converting it to a polycurve.
/// </param>
/// <param name="tolerance">
/// The tolerance, generally the document's absolute tolerance.
/// </param>
/// <param name="angleTolerance"></param>
/// <returns>
/// The results of the fillet operation. The number of output curves depends
/// on the input curves and the values of the parameters that were used
/// during the fillet operation. In most cases, the output array will contain
/// either one or three curves, although two curves can be returned if the
/// radius is zero and join = false.
/// For example, if both join and trim = true, then the output curve
/// will be a polycurve containing the fillet curve joined with trimmed copies
/// of the input curves. If join = false and trim = true, then three curves,
/// the fillet curve and trimmed copies of the input curves, will be returned.
/// If both join and trim = false, then just the fillet curve is returned.
/// </returns>
/// <example>
/// <code source='examples\vbnet\ex_filletcurves.vb' lang='vbnet'/>
/// <code source='examples\cs\ex_filletcurves.cs' lang='cs'/>
/// <code source='examples\py\ex_filletcurves.py' lang='py'/>
/// </example>
public static Curve[] CreateFilletCurves( Curve curve0, Point3d point0, Curve curve1, Point3d point1, double radius, bool join, bool trim, bool arcExtension, double tolerance, double angleTolerance)
{
IntPtr const_ptr_curve0 = curve0.ConstPointer();
IntPtr const_ptr_curve1 = curve1.ConstPointer();
using (var output_array = new SimpleArrayCurvePointer())
{
IntPtr ptr_output_array = output_array.NonConstPointer();
UnsafeNativeMethods.RHC_RhFilletCurve(const_ptr_curve0, point0, const_ptr_curve1, point1, radius, join, trim, arcExtension, tolerance, angleTolerance, ptr_output_array);
return output_array.ToNonConstArray();
}
}
示例14: Construct
IntPtr m_ptr; //CArgsRhinoSweep1*
public static ArgsSweep1 Construct(Curve rail, IEnumerable<Curve> crossSections, IEnumerable<double> crossSectionParameters,
Vector3d roadlike_up, bool closed, double sweep_tol, double angle_tol, int miter_type)
{
ArgsSweep1 rc = new ArgsSweep1();
List<Curve> xsec = new List<Curve>(crossSections);
List<double> xsec_t = new List<double>(crossSectionParameters);
if (xsec.Count < 1)
throw new ArgumentException("must have at least one cross section");
if (xsec.Count != xsec_t.Count)
throw new ArgumentException("must have same number of elements in crossSections and crossSectionParameters");
IntPtr pConstRail = rail.ConstPointer();
Runtime.InteropWrappers.SimpleArrayCurvePointer sections = new Rhino.Runtime.InteropWrappers.SimpleArrayCurvePointer(crossSections);
IntPtr pSections = sections.ConstPointer();
double[] tvals = xsec_t.ToArray();
rc.m_ptr = UnsafeNativeMethods.CArgsRhinoSweep1_New(pConstRail, pSections, tvals, roadlike_up, closed, sweep_tol, angle_tol, miter_type);
sections.Dispose();
return rc;
}
示例15: PullToBrepFace
/// <summary>
/// Pull a curve to a BrepFace using closest point projection.
/// </summary>
/// <param name="curve">Curve to pull.</param>
/// <param name="face">Brepface that pulls.</param>
/// <param name="tolerance">Tolerance to use for pulling.</param>
/// <returns>An array of pulled curves, or an empty array on failure.</returns>
public static Curve[] PullToBrepFace(Curve curve, BrepFace face, double tolerance)
{
IntPtr brep_ptr = face.m_brep.ConstPointer();
IntPtr curve_ptr = curve.ConstPointer();
using (SimpleArrayCurvePointer rc = new SimpleArrayCurvePointer())
{
IntPtr rc_ptr = rc.NonConstPointer();
if (UnsafeNativeMethods.RHC_RhinoPullCurveToBrep(brep_ptr, face.FaceIndex, curve_ptr, tolerance, rc_ptr))
{
return rc.ToNonConstArray();
}
return new Curve[0];
}
}