当前位置: 首页>>代码示例>>C#>>正文


C# Geometry.Curve类代码示例

本文整理汇总了C#中Rhino.Geometry.Curve的典型用法代码示例。如果您正苦于以下问题:C# Curve类的具体用法?C# Curve怎么用?C# Curve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Curve类属于Rhino.Geometry命名空间,在下文中一共展示了Curve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LineSource

            public LineSource(Curve SrcPath, String Code, int el_m, int SrcID, Phase_Regime ph)
                :base(new double[8]{60, 49, 41, 35, 31, 28, 26, 24}, new Point3d(0,0,0), ph, SrcID)
            {
                string type = SrcPath.GetUserString("SourceType");
                
                if (type == "Aircraft (ANCON derived)")
                {
                    double velocity = double.Parse(SrcPath.GetUserString("Velocity"));
                    double delta = double.Parse(SrcPath.GetUserString("delta"));
                    D = new ANCON(delta, velocity);
                }
                else D = new Simple();

                samplespermeter = el_m;
                Curve = SrcPath;

                //Divide curve up in ~equal length segments.
                Samples = Curve.DivideEquidistant(1.0 / (double)samplespermeter);

                Level = Utilities.PachTools.DecodeSourcePower(Code);
                Power = new double[8];
            
                double PowerMod = Curve.GetLength() / (double)Samples.Length;
                for (int oct = 0; oct < 8; oct++) Power[oct] = 1E-12 * Math.Pow(10, .1 * Level[oct]) * PowerMod;
            }
开发者ID:MengdiGuo,项目名称:PachydermAcoustic_Rhinoceros,代码行数:25,代码来源:LineSources.cs

示例2: SilkwormSegment

        public SilkwormSegment(Curve curve, int mainSegmentCount, int subSegmentCount, double maxAngleRadians, double maxChordLengthRatio, double maxAspectRatio, double tolerance, double minEdgeLength, double maxEdgeLength, bool keepStartPoint)
        {
            if (curve != null)
            {
                //See if curve can be represented as a polyline already
                if (curve.TryGetPolyline(out Pline))
                {
                    PolylineCurve plinecurve = new PolylineCurve(Pline);
                    //Segments = plinecurve.DuplicateSegments().ToList();
                    Segments = DuplicateSegments(plinecurve);
                }

                //Try to see if conversion will work
                if (curve.ToPolyline(mainSegmentCount, subSegmentCount, maxAngleRadians, maxChordLengthRatio, maxAspectRatio, tolerance, minEdgeLength, maxEdgeLength, keepStartPoint) != null)
                {
                    //Convert
                    PolylineCurve plinec = curve.ToPolyline(mainSegmentCount, subSegmentCount, maxAngleRadians, maxChordLengthRatio, maxAspectRatio, tolerance, minEdgeLength, maxEdgeLength, keepStartPoint);

                    if (plinec.TryGetPolyline(out Pline))
                    {
                        PolylineCurve plinecurve = new PolylineCurve(Pline);
                        //Segments = plinecurve.DuplicateSegments().ToList();
                        Segments = DuplicateSegments(plinecurve);
                    }
                }

            }
        }
开发者ID:samuto,项目名称:Silkworm,代码行数:28,代码来源:Segmenter.cs

示例3: Curves

        /// <summary>
        /// Use 0 as max if you do not want to set it.
        /// </summary>
        /// <param name="min">The minimun number of lines</param>
        /// <param name="max">The maximum, as in GetObject.GetMultiple()</param>
        /// <param name="lines"></param>
        /// <returns>True if the getting supplied the requested lines, false otherwise.</returns>
        public bool Curves(int min, int max, out Curve[] lines)
        {
            GetResult a;
            if (min == 1 && max == 1)
                a = this.Get();
            else
                a = this.GetMultiple(min, max);

            if (a == GetResult.Object)
            {
                if (this.ObjectCount > 0)
                {
                    int realCount = 0;

                    lines = new Curve[this.ObjectCount];
                    for (int i = 0; i < this.ObjectCount; i++)
                    {
                        Curve c = this.Object(i).Curve();
                        if (c != null && c.IsValid)
                        {
                            lines[realCount++] = c;
                        }
                    }
                    Array.Resize(ref lines, realCount);
                    return true;
                }
            }
            lines = null;

            return false;
        }
开发者ID:shortestwalk-demo,项目名称:ShortestWalk,代码行数:38,代码来源:CurvesGetter.cs

示例4: CurveCP

 public void CurveCP(Brep x, Curve y, int V, int U)
 {
     int u = bitmap1.Size.Width;
     int v = bitmap1.Size.Height;
     Graphics g = Graphics.FromImage(bitmap1);
     g.FillRectangle(new SolidBrush(Color.White), 0, 0, u, v);
     System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.Black);
     float step1 = u / U;
     float step2 = v / V;
     for (float i = 25; i < u - 25; i += step1)
     {
         for (float j = 25; j < v - 25; j += step2)
         {
             double Umin = x.Faces[0].Domain(0).Min;
             double Umax = x.Faces[0].Domain(0).Max;
             double Vmin = x.Faces[0].Domain(1).Min;
             double Vmax = x.Faces[0].Domain(1).Max;
             Point3d pos = x.Faces[0].PointAt(i / u * (Umax - Umin) + Umin, j / v * (Vmax - Vmin) + Vmin);
             double t; float R;
             if (y.ClosestPoint(pos, out t, 200))
             {
                 double dis = y.PointAt(t).DistanceTo(pos);
                 dis /= 200;
                 R = (float)(1 / dis * 2);
                 if (R > 40) R = 40;
             }
             else { R = 20; }
             g.FillEllipse(myBrush, i - R, v - j - R, R * 2, R * 2);
         }
     }
     myBrush.Dispose();
     g.Dispose();
 }
开发者ID:panhao4812,项目名称:MaterialTools,代码行数:33,代码来源:InitializeBitmap.cs

示例5: 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);
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:17,代码来源:opennurbs_revsurface.cs

示例6: DeviationConduit

 public DeviationConduit(Curve curveA, Curve curveB, Point3d minDistPointA, Point3d minDistPointB, Point3d maxDistPointA, Point3d maxDistPointB)
 {
   m_curve_a = curveA;
   m_curve_b = curveB;
   m_min_dist_point_a = minDistPointA;
   m_min_dist_point_b = minDistPointB;
   m_max_dist_point_a = maxDistPointA;
   m_max_dist_point_b = maxDistPointB;
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:9,代码来源:ex_crvdeviation.cs

示例7: 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);
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:15,代码来源:opennurbs_sumsurface.cs

示例8: Compute

    /// <summary>
    /// Computes an AreaMassProperties for a closed planar curve.
    /// </summary>
    /// <param name="closedPlanarCurve">Curve to measure.</param>
    /// <param name="planarTolerance">absolute tolerance used to insure the closed curve is planar</param>
    /// <returns>The AreaMassProperties for the given curve or null on failure.</returns>
    /// <exception cref="System.ArgumentNullException">When closedPlanarCurve is null.</exception>
    public static AreaMassProperties Compute(Curve closedPlanarCurve, double planarTolerance)
    {
      if (closedPlanarCurve == null)
        throw new ArgumentNullException("closedPlanarCurve");

      const double relativeTolerance = 1.0e-6;
      const double absoluteTolerance = 1.0e-6;
      IntPtr ptr = closedPlanarCurve.ConstPointer();
      IntPtr rc = UnsafeNativeMethods.ON_Curve_AreaMassProperties(ptr, relativeTolerance, absoluteTolerance, planarTolerance);
      return rc == IntPtr.Zero ? null : new AreaMassProperties(rc, false);
    }
开发者ID:austinlaw,项目名称:rhinocommon,代码行数:18,代码来源:opennurbs_massprop.cs

示例9: ConvertRhinoCommonCurve

 public static IfcBoundedCurve ConvertRhinoCommonCurve(DatabaseIfc db, Curve crv)
 {
     double tol = db.Tolerance, angTol = Math.PI / 1800;
     if (crv.IsLinear(tol))
         return new IfcPolyline(new List<IfcCartesianPoint>() { new IfcCartesianPoint(db, crv.PointAtStart), new IfcCartesianPoint(db, crv.PointAtEnd) });
     Plane pln = new Plane();
     if (crv.TryGetPlane(out pln, tol))
     {
         if (Math.Abs(pln.Origin.Z) < tol && pln.ZAxis.IsParallelTo(Vector3d.ZAxis, angTol) != 0)
             return convCurve(db, crv, true);
     }
     return convCurve(db, crv, false);
 }
开发者ID:jmirtsch,项目名称:GeometryGymIFC,代码行数:13,代码来源:IFC+B+RhinoCommon.cs

示例10: 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;
    }
开发者ID:austinlaw,项目名称:rhinocommon,代码行数:21,代码来源:opennurbs_circle.cs

示例11: 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;
 }
开发者ID:musamorena,项目名称:rhinocommon,代码行数:28,代码来源:opennurbs_bezier.cs

示例12: ReactionDiffusion

        public ReactionDiffusion(Mesh x, Curve y)
        {
            Vertice3.CreateCollection(x, out vs);
            Random rnd = new Random();
            for (int i = 0; i < vs.Count; i++)
            {

                Point3d P1 = new Point3d(vs[i].pos.X, vs[i].pos.Y, 0);
                if (y.Contains(P1) == Rhino.Geometry.PointContainment.Inside)
                {
                    vs[i].U = 0.5 * (rnd.NextDouble() * 2);
                    vs[i].V = 0.25 * (rnd.NextDouble() * 2);
                }
            }
        }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:15,代码来源:ReactionDiffusion.cs

示例13: ExtractTMesh

        public static TurtleMesh ExtractTMesh(Curve c)
        {
            var m = new TurtleMesh();
            Polyline pl;
            c.TryGetPolyline(out pl);

            TurtleFace f = new TurtleFace(pl.Count - 1);

            for (int j = 0; j < pl.Count - 1; j++)
            {
                var v = pl[j];
                f.Add(m.VertexCount);
                m.AddVertex(new TurtleVertex((float)v.X, (float)v.Y, (float)v.Z));
            }
            m.AddFace(f);
            return m;
        }
开发者ID:goznauk,项目名称:TurtleMesh,代码行数:17,代码来源:RhinoMeshSupport.cs

示例14: NextintersectParamAndPoint

 private void NextintersectParamAndPoint(Curve[] overlapCurves, Point3d[] intersectPoints,
   Curve curve, out double intersectParam, out Point3d intersectPoint)
 {
   var intersect_params_and_points = new Dictionary<double, Point3d>();
   foreach (var point in intersectPoints)
   {
     double curve_param;
     curve.ClosestPoint(point, out curve_param);
     intersect_params_and_points[curve_param] = point;
   }
   foreach (var overlap_curve in overlapCurves)
   {
     intersect_params_and_points[overlap_curve.Domain.Min] = overlap_curve.PointAt(overlap_curve.Domain.Min);
     intersect_params_and_points[overlap_curve.Domain.Max] = overlap_curve.PointAt(overlap_curve.Domain.Max);
   }
   var min_t = intersect_params_and_points.Keys.Min();
   intersectParam = min_t;
   intersectPoint = intersect_params_and_points[intersectParam];
 }
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:19,代码来源:ex_dividecurvestraight.cs

示例15: GetFeelerCrvs

    private static Curve[] GetFeelerCrvs(IParticle particle, double visionDistance,
                                  bool accurate)
    {
      Curve[] feelers;
      if (accurate)
      {
        feelers = new Curve[5];
      }
      else
      {
        feelers = new Curve[1];
      }

      double feelerAngle = RS.HALF_PI;
      //Calculate straight ahead feeler with length visionDistance
      Vector3d feelerVec = particle.Velocity;
      feelerVec.Unitize();
      feelerVec = Vector3d.Multiply(feelerVec, visionDistance);
      feelers[0] = new Line(particle.Position3D, feelerVec).ToNurbsCurve();

      if (!accurate)
      {
        return feelers;
      }

      //Calculate tertiary feelers with length bodySize
      feelerVec = particle.Velocity;
      feelerVec.Unitize();
      Plane rotPln = new Plane(particle.Position3D, particle.Velocity);
      Vector3d rotAxis = rotPln.XAxis;
      feelers[1] = GetFeelerCrv(feelerVec, particle.Position, particle.BodySize, feelerAngle, rotAxis);
      feelers[2] = GetFeelerCrv(feelerVec, particle.Position, particle.BodySize, -feelerAngle, rotAxis);
      rotAxis = rotPln.YAxis;
      feelers[3] = GetFeelerCrv(feelerVec, particle.Position, particle.BodySize, feelerAngle, rotAxis);
      feelers[4] = GetFeelerCrv(feelerVec, particle.Position, particle.BodySize, -feelerAngle, rotAxis);

      return feelers;
    }
开发者ID:lxfschr,项目名称:Quelea,代码行数:38,代码来源:AvoidObstacleForceComponent.cs


注:本文中的Rhino.Geometry.Curve类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。