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


C# Curve.PointAt方法代码示例

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


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

示例1: DivByAngle

    /**
     * divideCrvsByDeltaTan : Curve[] * double -> LinkedList<Plane>
     * REQUIRES: theta > 0
     * ENSURES: divideCrvsByDeltaTan(crvs, theta) returns a linked list of planes
     *          along the curves s.t. there is a plane at every point along
     *          the curve where the change in the tangent vector between
     *          two points is greater than theta.
    **/
    private IEnumerable<Point3d> DivByAngle(Curve crv, double angle)
    {

      //initialize parameters
      double theta = angle;
      Interval dom = crv.Domain;
      double stepSize = Math.Abs(dom.Length) * Constants.AbsoluteTolerance * Constants.AbsoluteTolerance;

      //initialize list
      List<Point3d> pts = new List<Point3d>();

      Continuity c = Continuity.C1_continuous;
      //initialize data
      
      double rover = dom.Min; //steps along the curve by stepSize

      //Add plane at start point of curve to list
      Point3d pt = crv.PointAt(rover);
      pts.Add(pt);

      //Increment
      Vector3d prevTan = crv.TangentAt(rover);
      double oldRover = rover; //stores the previous rover for comparison
      rover += stepSize;

      while (rover < dom.Max)
      {
        Vector3d currTan = crv.TangentAt(rover);
        //If there is a discontinuity between the oldRover and rover
        //then place a point at the discontinuity and update prevTan.
        double discontinuity;
        bool isDisc = crv.GetNextDiscontinuity(c, oldRover, rover,
          out discontinuity);
        if (isDisc)
        {
          pt = crv.PointAt(discontinuity);
          pts.Add(pt);
          prevTan = crv.TangentAt(discontinuity);
        }

        //If the change in tangent vector is greater than theta,
        //then drop a target at the rover and update prevTan.
        double delta = RhinoMath.ToDegrees(Math.Abs(Vector3d.VectorAngle(prevTan, currTan)));
        if (delta > theta)
        {
          pt = crv.PointAt(rover);
          pts.Add(pt);
          prevTan = currTan;
        }
        //Increment
        oldRover = rover;
        rover += stepSize;
      }

      //Add target at end point of curve
      pt = crv.PointAt(dom.Max);
      pts.Add(pt);
      return pts;
    }
开发者ID:lxfschr,项目名称:Quelea,代码行数:67,代码来源:PolysurfaceEnvironmentType.cs

示例2: CreateFillet

    /// <summary>
    /// Computes the fillet arc for a curve filleting operation.
    /// </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 on curve0 where the fillet ought to start (approximately).</param>
    /// <param name="t1Base">Parameter on curve1 where the fillet ought to end (approximately).</param>
    /// <returns>The fillet arc on success, or Arc.Unset on failure.</returns>
    public static Arc CreateFillet(Curve curve0, Curve curve1, double radius, double t0Base, double t1Base)
    {
      Arc arc = Arc.Unset;

      double t0, t1;
      Plane plane;
      if (GetFilletPoints(curve0, curve1, radius, t0Base, t1Base, out t0, out t1, out plane))
      {
        Vector3d radial0 = curve0.PointAt(t0) - plane.Origin;
        Vector3d radial1 = curve1.PointAt(t1) - plane.Origin;
        radial0.Unitize();
        radial1.Unitize();

        double angle = System.Math.Acos(radial0 * radial1);
        Plane fillet_plane = new Plane(plane.Origin, radial0, radial1);
        arc = new Arc(fillet_plane, plane.Origin, radius, angle);
      }
      return arc;
    }
开发者ID:JohannesKu,项目名称:rhinocommon,代码行数:28,代码来源:opennurbs_curve.cs

示例3: horizFrame

 public Plane horizFrame(Curve C, double t)
 {
     //Create a plane aligned with the world z-axis
     Vector3d Tangent = C.TangentAt(t);
     Vector3d Z = Vector3d.ZAxis;
     Z.Reverse();
     Vector3d Perp = Vector3d.CrossProduct(Z, Tangent);
     Plane frame = new Plane(C.PointAt(t), Tangent, Perp);
     return frame;
 }
开发者ID:samuto,项目名称:Silkworm,代码行数:10,代码来源:SilkwormSkein.cs

示例4: GetLBCurve

        private LyrebirdCurve GetLBCurve(Curve crv)
        {
            LyrebirdCurve lbc = null;

            List<LyrebirdPoint> points = new List<LyrebirdPoint>();
            if (crv.IsLinear())
            {
                // standard linear element
                points.Add(new LyrebirdPoint(crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z));
                points.Add(new LyrebirdPoint(crv.PointAtEnd.X, crv.PointAtEnd.Y, crv.PointAtEnd.Z));
                lbc = new LyrebirdCurve(points, "Line");
            }
            else if (crv.IsCircle())
            {
                crv.Domain = new Interval(0, 1);
                points.Add(new LyrebirdPoint(crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z));
                points.Add(new LyrebirdPoint(crv.PointAt(0.25).X, crv.PointAt(0.25).Y, crv.PointAt(0.25).Z));
                points.Add(new LyrebirdPoint(crv.PointAt(0.5).X, crv.PointAt(0.5).Y, crv.PointAt(0.5).Z));
                points.Add(new LyrebirdPoint(crv.PointAt(0.75).X, crv.PointAt(0.75).Y, crv.PointAt(0.75).Z));
                points.Add(new LyrebirdPoint(crv.PointAtEnd.X, crv.PointAtEnd.Y, crv.PointAtEnd.Z));
                lbc = new LyrebirdCurve(points, "Circle");
            }
            else if (crv.IsArc())
            {
                crv.Domain = new Interval(0, 1);
                // standard arc element
                points.Add(new LyrebirdPoint(crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z));
                points.Add(new LyrebirdPoint(crv.PointAt(0.5).X, crv.PointAt(0.5).Y, crv.PointAt(0.5).Z));
                points.Add(new LyrebirdPoint(crv.PointAtEnd.X, crv.PointAtEnd.Y, crv.PointAtEnd.Z));
                lbc = new LyrebirdCurve(points, "Arc");
            }
            else
            {
                // Spline
                // Old line: if (crv.Degree >= 3)
                if (crv.Degree == 3)
                {
                    NurbsCurve nc = crv as NurbsCurve;
                    if (nc != null)
                    {
                        List<LyrebirdPoint> lbPoints = new List<LyrebirdPoint>();
                        List<double> weights = new List<double>();
                        List<double> knots = new List<double>();

                        foreach (ControlPoint cp in nc.Points)
                        {
                            LyrebirdPoint pt = new LyrebirdPoint(cp.Location.X, cp.Location.Y, cp.Location.Z);
                            double weight = cp.Weight;
                            lbPoints.Add(pt);
                            weights.Add(weight);
                        }
                        for (int k = 0; k < nc.Knots.Count; k++)
                        {
                            double knot = nc.Knots[k];
                            // Add a duplicate knot for the first and last knot in the Rhino curve.
                            // Revit needs 2 more knots than Rhino to define a spline.
                            if (k == 0 || k == nc.Knots.Count - 1)
                            {
                                knots.Add(knot);
                            }
                            knots.Add(knot);
                        }

                        lbc = new LyrebirdCurve(lbPoints, weights, knots, nc.Degree, nc.IsPeriodic) { CurveType = "Spline" };
                    }
                }
                else
                {
                    const double incr = 1.0 / 100;
                    List<LyrebirdPoint> pts = new List<LyrebirdPoint>();
                    List<double> weights = new List<double>();
                    for (int i = 0; i <= 100; i++)
                    {
                        Point3d pt = crv.PointAtNormalizedLength(i * incr);
                        LyrebirdPoint lbp = new LyrebirdPoint(pt.X, pt.Y, pt.Z);
                        weights.Add(1.0);
                        pts.Add(lbp);
                    }

                    lbc = new LyrebirdCurve(pts, "Spline") { Weights = weights, Degree = crv.Degree };
                }
            }

            return lbc;
        }
开发者ID:ramonvanderheijden,项目名称:Lyrebird,代码行数:85,代码来源:GHClient.cs

示例5: MeshLoft

 public Mesh MeshLoft(Curve c1, Curve c2, int u, int v)
 {
     double[] uList1 = c1.DivideByCount(u, true);
     double[] uList2 = c2.DivideByCount(u, true);
     List<Polyline> input1 = new List<Polyline>();
     for (int i = 0; i < uList1.Length; i++)
     {
         Point3d p1 = c1.PointAt(uList1[i]);
         Point3d p2 = c2.PointAt(uList2[i]);
         Vector3d V = p2 - p1;
         V /= v;
         Polyline pl = new Polyline();
         for (int k = 0; k < v + 1; k++)
         {
             pl.Add(p1 + (V * k));
         }
         input1.Add(pl);
     }
     return MeshLoft(input1, false, false);
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:20,代码来源:MeshCreation.cs

示例6: TriangleMeshLoft2

 public Mesh TriangleMeshLoft2(Curve c1, Curve c2, int t1, int t2)
 {
     Vector3d v1 = c1.PointAtEnd - c1.PointAtStart;
     Vector3d v2 = c2.PointAtEnd - c2.PointAtStart;
     if (Vector3d.VectorAngle(v1, v2) > Math.PI / 2) { c2.Reverse(); }
     Mesh mesh = new Mesh();
     List<Point3d> ps = new List<Point3d>();
     int Count = t1 - t2;
     double[] t01 = c1.DivideByCount(Count, true);
     double[] t02 = c2.DivideByCount(Count, true);
     for (int i = t2; i <= t1; i++)
     {
         Point3d p1 = c1.PointAt(t01[i - t2]);
         Point3d p2 = c2.PointAt(t02[i - t2]);
         Vector3d v = p2 - p1;
         for (int k = 0; k < i; k++)
         {
             double t3 = 0;
             if (i > 1) { t3 = ((double)k / (double)(i - 1)); }
             ps.Add(p1 + v * t3);
         }
     }
     if (t2 > 1)
     {
         return TriangleMeshFromPoints(ps, t2, t1);
     }
     if (t2 == 1) { return TriangleMeshFromPoints(ps); }
     else return mesh;
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:29,代码来源:MeshCreation.cs

示例7: TriangleMeshLoft

        public Mesh TriangleMeshLoft(Curve c1, Curve c2, int t1, int t2)
        {
            //t2>t1;
            Vector3d v1 = c1.PointAtEnd - c1.PointAtStart;
            Vector3d v2 = c2.PointAtEnd - c2.PointAtStart;
            if (Vector3d.VectorAngle(v1, v2) > Math.PI / 2) { c2.Reverse(); }

            List<Point3d> ps = new List<Point3d>();
            double[] t0 = c2.DivideByCount(t2 - 1, true);
            for (int i = 0; i < t0.Length; i++)
            { ps.Add(c2.PointAt(t0[i])); }

            for (int i = t2; i < t1; i++)
            {
                t0 = c2.DivideByCount(i, true);
                double[] t01 = c1.DivideByCount(i, true);
                for (int k = 0; k < t01.Length; k++)
                {
                    Vector3d v = c1.PointAt(t01[k]) - c2.PointAt(t0[k]);
                    v *= (double)((i - t2 + 1)) / (double)(t1 - t2);
                    ps.Add(c2.PointAt(t0[k]) + v);
                }
            }
            return TriangleMeshFromPoints(ps, t2, t1);
        }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:25,代码来源:MeshCreation.cs

示例8: MeshSweep1

 public Mesh MeshSweep1(Curve l, Curve l2, int Count, int Count2)
 {
     Polyline ls = new Polyline();
     double[] div = l2.DivideByCount(Count2, true);
     for (int i = 0; i < div.Length; i++)
     {
         ls.Add(l2.PointAt(div[i]));
     }
     return MeshSweep1(l, ls, Count);
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:10,代码来源:MeshCreation.cs

示例9: 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

示例10: Directions

                public override BroadRay Directions(int index, int thread, ref Random random, ref Curve Curves, ref double[] DomainPower, ref double Delay, ref Phase_Regime ph, ref int S_ID)
                {
                    double pos = random.NextDouble();
                    int i;

                    Interval t = Curves.Domain;
                    double x = random.NextDouble() * (t[1] - t[0]) + t[0];
                    Point3d P = Curves.PointAt(x);
                    Vector3d f = Curves.TangentAt(x);
                    Vector fore = new Hare.Geometry.Vector(f.X, f.Y, f.Z);

                    double Theta = random.NextDouble() * 2 * System.Math.PI;
                    double Phi = random.NextDouble() * 2 * System.Math.PI;
                    Vector Direction = new Hare.Geometry.Vector(Math.Sin(Theta) * Math.Cos(Phi), Math.Sin(Theta) * Math.Sin(Phi), Math.Cos(Theta));

                    double cosphi = Hare.Geometry.Hare_math.Dot(Direction, fore);
                    double sinphi = Math.Sqrt(1 - cosphi * cosphi);
                    double tanphi =  sinphi/cosphi;
                    double F_r = sinphi * sinphi * Math.Pow((tanphi * tanphi + 1) / (tanphi * tanphi + (1 + tanphi * Math.Tan(delta))), 1.5);

                    double[] power = new double[8];
                    for (int oct = 0; oct < 8; oct++) power[oct] = DomainPower[oct] * reciprocal_velocity * dLinf * F_r;
                    double[] phase = new double[8];
                    if (ph == Phase_Regime.Random) for (int o = 0; o < 8; o++) phase[o] = random.Next() * 2 * Math.PI;
                    else for (int o = 0; o < 8; o++) phase[o] = 0 - Delay * Utilities.Numerics.angularFrequency[o];

                    return new BroadRay(Utilities.PachTools.RPttoHPt(P), Direction, random.Next(), thread, DomainPower, phase, Delay, S_ID);
                }
开发者ID:MengdiGuo,项目名称:PachydermAcoustic_Rhinoceros,代码行数:28,代码来源:LineSources.cs

示例11: DirPower

                public override double[] DirPower(int threadid, int random, Vector Direction, double position, ref Curve Curves, ref double[] DomainPower)
                {
                    X_Event X = new X_Event();
                    double[] RayPower = new double[8];

                    Interval t = Curves.Domain;
                    Point3d P = Curves.PointAt((position/t.Length) + t.Min);
                    Vector3d f = Curves.TangentAt(position);
                    Vector fore = new Hare.Geometry.Vector(f.X, f.Y, f.Z);

                    double cosphi = Hare.Geometry.Hare_math.Dot(Direction, fore);
                    double sinphi = Math.Sqrt(1 - cosphi * cosphi);
                    double tanphi = sinphi / cosphi;
                    double F_r = sinphi * sinphi * Math.Pow((tanphi * tanphi + 1) / (tanphi * tanphi + (1 + tanphi * Math.Tan(delta))), 1.5);

                    for (int oct = 0; oct < 8; oct++)
                    {
                        if (DomainPower[oct] == 0)
                        {
                            RayPower[oct] = 0;
                        }
                        else
                        {
                            RayPower[oct] = DomainPower[oct] * reciprocal_velocity * dLinf * F_r;
                        }
                    }
                    return RayPower;
                }
开发者ID:MengdiGuo,项目名称:PachydermAcoustic_Rhinoceros,代码行数:28,代码来源:LineSources.cs

示例12: RunScript

    private void RunScript(Brep x, Curve y, int V, int U, ref object A)
    {
        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);
                    //  Print(R.ToString());
                    if (R > 40) R = 40;
                    ;
                }
                else { R = 20; }
                g.FillEllipse(myBrush, i - R, v - j - R, R * 2, R * 2);
            }
        }

        myBrush.Dispose();
        str = @"C:\maps\temp1.jpg";
        bitmap1.Save(str);
        Print(str);
        ///////////////////////////////////////////////////////////////////////////////////////////////////////
        Mesh[] meshes = Mesh.CreateFromBrep(x, MeshingParameters.Smooth);
        Mesh M = new Mesh();
        foreach (Mesh partialMesh in meshes)
        {
            M.Append(partialMesh);
        }
        m_shapes.Add(M);

        Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial();
        mat.SetTransparencyTexture(str, true);
        mat.BackTransparency = 0;
        m_materials.Clear();
        m_materials.Add(mat);
    }
开发者ID:panhao4812,项目名称:TempCodesAndStudy,代码行数:51,代码来源:BitmapOrigon.cs

示例13: computeBiasHeight

        private double computeBiasHeight(Point3d P, bool biasApicalRegions, Curve boundaryCurve)
        {
            double t;
            boundaryCurve.ClosestPoint(P, out t);
            double minDist = Utils.Distance(P, boundaryCurve.PointAt(t));

            if (biasApicalRegions)
                foreach (Circle apical in iApicals)
                {
                    double dist = Utils.Distance(P, apical.Center) - (apical.Radius + 0.1);
                    if (dist < 0.0) dist = 0.0;

                    if (dist < minDist)
                        minDist = dist;
                }

            return iInitialCurvingBias * (1.0 - Math.Pow(0.9, minDist * 15.0));
        }
开发者ID:GeneKao,项目名称:Pavilion2015_ITECH,代码行数:18,代码来源:GHC_PointsToMesh2.cs


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