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


C# Plane.PointAt方法代码示例

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


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

示例1: Metaball

        public Mesh Metaball(double iso)
        {
            this.use_iso = iso;
            Plane plane = new Plane();
            Plane.FitPlaneToPoints(use_charges, out plane);
            plane.Origin = use_charges[0];
            Interval xSize = new Interval(-use_radii[0], use_radii[0]);
            Box box = new Box(plane, xSize, xSize, xSize);
            int num27 = use_charges.Count - 1;
            for (int i = 1; i <= num27; i++)
            {
                plane.Origin = use_charges[i];
                box.Union(plane.PointAt(-use_radii[i], -use_radii[i], -use_radii[i]));
                box.Union(plane.PointAt(use_radii[i], use_radii[i], use_radii[i]));
            }
            box.Inflate(res);
            int xSet = (int)Math.Round((double)(box.X.Length / res));
            int ySet = (int)Math.Round((double)(box.Y.Length / res));
            int zSet = (int)Math.Round((double)(box.Z.Length / res));
            double xLength = box.X.Length / ((double)xSet);
            double yLength = box.Y.Length / ((double)ySet);
            double zLength = box.Z.Length / ((double)zSet);
            double xBase = xLength / 2.0;
            double yBase = yLength / 2.0;
            double zBase = zLength / 2.0;
            plane.Origin = box.GetCorners()[0];
            List<Point3d> list = new List<Point3d>();
            Mesh mesh = new Mesh();

            for (int j = 0; j <= xSet - 1; j++)
            {
                for (int m = 0; m <= ySet - 1; m++)
                {
                    for (int n = 0; n <= zSet - 1; n++)
                    {
                        Point3d item = plane.PointAt(xBase + (xLength * j), yBase + (yLength * m), zBase + (zLength * n));
                        int xSet1 = use_charges.Count - 1;
                        for (int k = 0; k <= xSet1; k++)
                        {
                            if (item.DistanceTo(use_charges[k]) < (use_radii[k] + res))
                            {
                                Plane pl = plane;
                                pl.Origin = item;
                                Mesh other = this.local_tet(pl, xBase, yBase, zBase);
                                mesh.Append(other);
                                list.Add(item);
                                break;
                            }
                        }
                    }
                }
            }
            mesh.Vertices.CombineIdentical(true, true);
            mesh.UnifyNormals();
            return mesh;
        }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:56,代码来源:MetaMCT.cs

示例2: CreateKnuckle

        /// <summary>
        /// Creates knuckle vertices. (generally for sleeve meshing, but also used for 'sharp' node plates)
        /// </summary>
        public static List<Point3d> CreateKnuckle(Plane plane, int sides, double radius, double startAngle)
        {
            var Vtc = new List<Point3d>();

            // This loop rotates around the strut, creating vertices
            for (int k = 0; k < sides; k++)
            {
                double angle = k * 2 * Math.PI / sides + startAngle;
                // Create vertex
                Vtc.Add(plane.PointAt(radius * Math.Cos(angle), radius * Math.Sin(angle)));
            }

            return Vtc;
        }
开发者ID:smor,项目名称:intralattice,代码行数:17,代码来源:MeshTools.cs

示例3: VertexAdd

 public static void VertexAdd(ref Mesh Msh, Plane Pln, double S, double R, bool Affix, Rhino.Collections.Point3dList Pts, Mesh AffixMesh)
 {
     for (int I = 1; I <= S; I++)
     {
         double Angle = ((double)I / S) * 2.0 * Math.PI;
         if (Affix) Msh.Vertices.Add(AffixMesh.Vertices[Pts.ClosestIndex(Pln.PointAt(Math.Cos(Angle) * R, Math.Sin(Angle) * R, 0))]);
         else Msh.Vertices.Add(Pln.PointAt(Math.Cos(Angle) * R, Math.Sin(Angle) * R, 0));
     }
     return;
 }
开发者ID:nsbcnjsbc,项目名称:Exoskeleton2,代码行数:10,代码来源:ExoTools.cs

示例4: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List<DHr> hours = new List<DHr>();
            List<String> keys = new List<string>();
            if (DA.GetDataList(0, hours) && DA.GetDataList(1, keys)) {
                if ((hours[0].is_surrogate) && ((hours.Count != 1) && (hours.Count != 12) && (hours.Count != 52) && (hours.Count != 365))) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "This component can only plot unmasked surrogate hours for yearly, monthly, weekly, and daily statistics"); }

                Interval ival_y = new Interval();
                bool calc_ival_y = false;
                if (!(DA.GetData(2, ref ival_y))) {
                    ival_y.T0 = hours[0].val(keys[0]);
                    ival_y.T1 = hours[0].val(keys[0]);
                    calc_ival_y = true;
                }
                Dictionary<string, float[]> val_dict = new Dictionary<string, float[]>();
                List<Interval> val_ranges = new List<Interval>();
                foreach (string key in keys) {
                    Interval ival = new Interval();
                    float[] vals = new float[0];
                    DHr.get_domain(key, hours.ToArray(), ref vals, ref ival);
                    vals = new float[hours.Count];
                    for (int h = 0; h < hours.Count; h++) vals[h] = hours[h].val(key);
                    val_dict.Add(key, vals);
                    val_ranges.Add(ival);
                }

                bool force_start_at_zero = true;

                int stack_dir = StackDirection(val_ranges[0]);
                if (stack_dir==0) this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The first key returned nothing but zero values.  I can't deal!");
                foreach (Interval ival in val_ranges) {
                    if (StackDirection(ival) != stack_dir) this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "A stacked graph can only handle all negative or all positive numbers.");
                    if (calc_ival_y) {
                        if (stack_dir < 1) {
                            if (ival.T1 > ival_y.T0) ival_y.T0 = ival.T1;
                            if (ival.T0 < ival_y.T1) ival_y.T1 = ival.T0;
                        } else {
                            if (ival.T0 < ival_y.T0) ival_y.T0 = ival.T0;
                            if (ival.T1 > ival_y.T1) ival_y.T1 = ival.T1;
                        }
                    }
                }

                if (force_start_at_zero && calc_ival_y) ival_y.T0 = 0;

                Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Interval> intervalTreeOut = new Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Interval>();
                intervalTreeOut.Append(new Grasshopper.Kernel.Types.GH_Interval(ival_y),new Grasshopper.Kernel.Data.GH_Path(0));
                foreach (Interval ival in val_ranges) intervalTreeOut.Append(new Grasshopper.Kernel.Types.GH_Interval(ival), new Grasshopper.Kernel.Data.GH_Path(1));

                Plane plane = new Plane(new Point3d(0, 0, 0), new Vector3d(0, 0, 1));
                DA.GetData(3, ref plane);

                Grasshopper.Kernel.Types.UVInterval ival2d = new Grasshopper.Kernel.Types.UVInterval();
                if (!DA.GetData(4, ref ival2d)) {
                    ival2d.U0 = 0.0;
                    ival2d.U1 = 12.0;
                    ival2d.V0 = 0.0;
                    ival2d.V1 = 1.0;
                }

                double barWidth = 1.0;
                DA.GetData(5, ref barWidth);

                Grasshopper.Kernel.Data.GH_Structure<DHr> hourTreeOut = new Grasshopper.Kernel.Data.GH_Structure<DHr>();
                Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Point> pointTreeOut = new Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Point>();
                Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Rectangle> rectTreeOut = new Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Rectangle>();
                List<Point3d> basepoints = new List<Point3d>();
                for (int h = 0; h < hours.Count; h++) {
                    Point3d gpt = GraphPoint(hours[h].hr, 0.0f, plane, ival_y, ival2d);
                    Point3d wpt = plane.PointAt(gpt.X, 0.0);
                    basepoints.Add(wpt);
                }

                for (int k = 0; k < keys.Count; k++) {
                    Grasshopper.Kernel.Data.GH_Path key_path = new Grasshopper.Kernel.Data.GH_Path(k);
                    List<Point3d> points = new List<Point3d>();
                    List<Rectangle3d> rects = new List<Rectangle3d>();

                    for (int h = 0; h < hours.Count; h++) {
                        float val = val_dict[keys[k]][h];
                        for (int kk = 0; kk < k; kk++) val += val_dict[keys[kk]][h]; // add in all previous values
                        Point3d gpt = GraphPoint(hours[h].hr, val, plane, ival_y, ival2d); // returns a point in graph coordinates

                        hours[h].pos = gpt; // the hour records the point in graph coordinates
                        hourTreeOut.Append(new DHr(hours[h]), key_path);

                        Point3d wpt = plane.PointAt(gpt.X, gpt.Y);
                        points.Add(wpt); // adds this point in world coordinates

                        Interval ival_gx; // interval of horz space occupied by this hour in graphic units
                        Interval ival_gy = new Interval(ival2d.V0, gpt.Y); // interval of vertical space occupied by this hour in graphic units
                        if (!hours[h].is_surrogate) {
                            double delta_x2 = (Math.Abs(ival2d.U.Length) / 8760 / 2.0);
                            ival_gx = new Interval(gpt.X - delta_x2, gpt.X + delta_x2); // interval of horz space occupied by this hour in graphic units
                        } else {

                            // if we've been passed surrogate hours, the spacing between bars may not be consistant
                            // we assume we've been given an hour at the start of the range represented
                            double ival_gx_0 = gpt.X;
                            double ival_gx_1;
//.........这里部分代码省略.........
开发者ID:ksteinfe,项目名称:dyear,代码行数:101,代码来源:Components+Spatializing.cs

示例5: FakeArc

        private static Point3d[] FakeArc(Plane plane, double r, double t0, double t1, int count)
        {
            Point3d[] parr = new Point3d[count];
            double step = ((t1 - t0) / (count - 1));
            for (int n = 0; n < count; n++) {
                double t = t0 + n * step;
                Point3d pt = PointByCylCoords(r, t);
                parr[n] = plane.PointAt(pt.X, pt.Y);

            }
            return parr;
        }
开发者ID:ksteinfe,项目名称:dyear,代码行数:12,代码来源:Components+Spatializing.cs

示例6: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //declare and set primary variables

            List<Curve> L = new List<Curve>();
            int S = 0;
            List<double> Rs = new List<double>();
            List<double> Re = new List<double>();
            double D = 0;
            double ND = 0;
            bool O = false;

            if (!DA.GetDataList(0, L)) { return; }
            if (!DA.GetData(1, ref S)) { return; }
            if (!DA.GetDataList(2, Rs)) { return; }
            if (!DA.GetDataList(3, Re)) { return; }
            if (!DA.GetData(4, ref ND)) { return; }
            if (!DA.GetData(5, ref D)) { return; }
            if (!DA.GetData(6, ref O)) { return; }

            if (L == null || L.Count == 0) { return; }
            if (S < 3) { return; }
            if (Rs == null || Rs.Count == 0 || Rs.Contains(0)) { return; }
            if (Re == null || Re.Count == 0 || Rs.Contains(0)) { return; }
            if (D == 0) { return; }

            //declare node and strut lists and reference lookups

            double Sides = (double)S;

            List<Point3d> Nodes = new List<Point3d>();
            List<List<int>> NodeStruts = new List<List<int>>();

            List<Curve> Struts = new List<Curve>();
            List<int> StrutNodes = new List<int>();
            List<double> StrutRadii = new List<double>();

            double tol = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;

            //set the index counter for matching start and end radii from input list
            int IdxL = 0;

            //register unique nodes and struts, with reference lookups
            //each full strut is broken into two half-struts, with the even-indexed
            //element being the start point, and the odd-indexed element being the end point

            //initialise first node
            Nodes.Add(L[0].PointAtStart);
            NodeStruts.Add(new List<int>());

            Rhino.Collections.Point3dList NodeLookup = new Rhino.Collections.Point3dList(Nodes);

            foreach (Curve StartL in L)
            {
                double StrutStartRadius = 0;
                if (Rs.Count - 1 > IdxL) StrutStartRadius = Rs[IdxL];
                else StrutStartRadius = Rs.Last();

                double StrutEndRadius = 0;
                if (Re.Count - 1 > IdxL) StrutEndRadius = Re[IdxL];
                else StrutEndRadius = Re.Last();

                Point3d StrutCenter = new Point3d((StartL.PointAtStart + StartL.PointAtEnd) / 2);

                int StartTestIdx = NodeLookup.ClosestIndex(StartL.PointAtStart);
                if (Nodes[StartTestIdx].DistanceTo(StartL.PointAtStart) < tol)
                {
                    NodeStruts[StartTestIdx].Add(Struts.Count);
                    StrutNodes.Add(StartTestIdx);
                }
                else
                {
                    StrutNodes.Add(Nodes.Count);
                    Nodes.Add(StartL.PointAtStart);
                    NodeLookup.Add(StartL.PointAtStart);
                    NodeStruts.Add(new List<int>());
                    NodeStruts.Last().Add(Struts.Count());
                }
                Struts.Add(new LineCurve(StartL.PointAtStart, StrutCenter));
                StrutRadii.Add(StrutStartRadius);

                int EndTestIdx = NodeLookup.ClosestIndex(StartL.PointAtEnd);
                if (Nodes[EndTestIdx].DistanceTo(StartL.PointAtEnd) < tol)
                {
                    NodeStruts[EndTestIdx].Add(Struts.Count);
                    StrutNodes.Add(EndTestIdx);
                }
                else
                {
                    StrutNodes.Add(Nodes.Count);
                    Nodes.Add(StartL.PointAtEnd);
                    NodeLookup.Add(StartL.PointAtEnd);
                    NodeStruts.Add(new List<int>());
                    NodeStruts.Last().Add(Struts.Count);
                }
                Struts.Add(new LineCurve(StartL.PointAtEnd, StrutCenter));
                StrutRadii.Add(StrutEndRadius);

                IdxL += 1;
            }
//.........这里部分代码省略.........
开发者ID:nsbcnjsbc,项目名称:Exoskeleton2,代码行数:101,代码来源:ExoWireframe.cs

示例7: DrawPlane

        private static void DrawPlane(DisplayPipeline di, RhinoViewport vp, Plane plane)
        {
            double num;

            if (!vp.GetWorldToScreenScale(plane.Origin, out num))
                return;

            var unit = 10.0;

            if ((unit * num) < 20.0)
                unit = 20.0 / num;

            unit *= 0.2;

            var min = -5;
            var max = 5;

            for (var x = min; x <= max; x++)
            {
                var p0 = plane.PointAt(min * unit, x * unit);
                var p1 = plane.PointAt(max * unit, x * unit);

                if (x == 0)
                {
                    var origin = plane.Origin;
                    di.DrawLine(p0, origin, Color.Gray);
                    di.DrawLine(origin, p1, Color.DarkRed, 3);
                    di.DrawArrowHead(p1, p1 - origin, Color.DarkRed, 0.0, 1.0 * unit);
                }
                else
                {
                    di.DrawLine(p0, p1, Color.Gray);
                }
            }

            for (var y = min; y <= max; y++)
            {
                var p0 = plane.PointAt(y * unit, min * unit);
                var p1 = plane.PointAt(y * unit, max * unit);

                if (y == 0)
                {
                    var origin = plane.Origin;
                    di.DrawLine(p0, origin, Color.Gray);
                    di.DrawLine(origin, p1, Color.DarkGreen, 3);
                    di.DrawArrowHead(p1, p1 - origin, Color.DarkGreen, 0.0, 1.0 * unit);
                }
                else
                {
                    di.DrawLine(p0, p1, Color.Gray);
                }
            }
        }
开发者ID:olitur,项目名称:Bowerbird,代码行数:53,代码来源:PlaneGetter.cs

示例8: local_tet

        private Mesh local_tet(Plane pl, double xBase, double yBase, double zBase)
        {
            List<Point3d> list = new List<Point3d> {
              pl.PointAt(-xBase, yBase, -zBase),
              pl.PointAt(xBase, yBase, -zBase),
              pl.PointAt(xBase, -yBase, -zBase),
              pl.PointAt(-xBase, -yBase, -zBase),
              pl.PointAt(-xBase, yBase, zBase),
              pl.PointAt(xBase, yBase, zBase),
              pl.PointAt(xBase, -yBase, zBase),
              pl.PointAt(-xBase, -yBase, zBase)
              };

            List<double> list2 = new List<double>();
            foreach (Point3d pointd in list)
            {
                double item = this.calculate_field(pointd);
                list2.Add(item);
            }
            DataTree<Point3d> tree = new DataTree<Point3d>();
            Point3d[] data = new Point3d[] { list[0], list[2], list[3], list[7] };
            tree.AddRange(data, new GH_Path(0));
            data = new Point3d[] { list[0], list[2], list[6], list[7] };
            tree.AddRange(data, new GH_Path(1));
            data = new Point3d[] { list[0], list[4], list[6], list[7] };
            tree.AddRange(data, new GH_Path(2));
            data = new Point3d[] { list[0], list[6], list[1], list[2] };
            tree.AddRange(data, new GH_Path(3));
            data = new Point3d[] { list[0], list[6], list[1], list[4] };
            tree.AddRange(data, new GH_Path(4));
            data = new Point3d[] { list[5], list[6], list[1], list[4] };
            tree.AddRange(data, new GH_Path(5));
            DataTree<double> tree2 = new DataTree<double>();
            tree2.AddRange(new double[] { list2[0], list2[2], list2[3], list2[7] }, new GH_Path(0));
            tree2.AddRange(new double[] { list2[0], list2[2], list2[6], list2[7] }, new GH_Path(1));
            tree2.AddRange(new double[] { list2[0], list2[4], list2[6], list2[7] }, new GH_Path(2));
            tree2.AddRange(new double[] { list2[0], list2[6], list2[1], list2[2] }, new GH_Path(3));
            tree2.AddRange(new double[] { list2[0], list2[6], list2[1], list2[4] }, new GH_Path(4));
            tree2.AddRange(new double[] { list2[5], list2[6], list2[1], list2[4] }, new GH_Path(5));
            Mesh mesh = new Mesh();
            foreach (GH_Path path in tree2.Paths)
            {
                List<Point3d> list3 = tree.Branch(path);
                List<double> list4 = tree2.Branch(path);
                int num2 = 0;
                if (list4[0] < this.use_iso)
                {
                    num2 |= 1;
                }
                if (list4[1] < this.use_iso)
                {
                    num2 |= 2;
                }
                if (list4[2] < this.use_iso)
                {
                    num2 |= 4;
                }
                if (list4[3] < this.use_iso)
                {
                    num2 |= 8;
                }
                Mesh other = new Mesh();
                switch (num2)
                {
                    case 1:
                    case 14:
                        other.Vertices.Add(this.interp_vertex(list3[0], list3[1], list4[0], list4[1]));
                        other.Vertices.Add(this.interp_vertex(list3[0], list3[2], list4[0], list4[2]));
                        other.Vertices.Add(this.interp_vertex(list3[0], list3[3], list4[0], list4[3]));
                        other.Faces.AddFace(0, 1, 2);
                        break;

                    case 2:
                    case 13:
                        other.Vertices.Add(this.interp_vertex(list3[1], list3[0], list4[1], list4[0]));
                        other.Vertices.Add(this.interp_vertex(list3[1], list3[3], list4[1], list4[3]));
                        other.Vertices.Add(this.interp_vertex(list3[1], list3[2], list4[1], list4[2]));
                        other.Faces.AddFace(0, 1, 2);
                        break;

                    case 3:
                    case 12:
                        other.Vertices.Add(this.interp_vertex(list3[0], list3[3], list4[0], list4[3]));
                        other.Vertices.Add(this.interp_vertex(list3[0], list3[2], list4[0], list4[2]));
                        other.Vertices.Add(this.interp_vertex(list3[1], list3[3], list4[1], list4[3]));
                        other.Faces.AddFace(0, 1, 2);
                        other.Vertices.Add(this.interp_vertex(list3[1], list3[2], list4[1], list4[2]));
                        other.Faces.AddFace(2, 3, 1);
                        break;

                    case 4:
                    case 11:
                        other.Vertices.Add(this.interp_vertex(list3[2], list3[0], list4[2], list4[0]));
                        other.Vertices.Add(this.interp_vertex(list3[2], list3[1], list4[2], list4[1]));
                        other.Vertices.Add(this.interp_vertex(list3[2], list3[3], list4[2], list4[3]));
                        other.Faces.AddFace(0, 1, 2);
                        break;

                    case 5:
                    case 10:
//.........这里部分代码省略.........
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:101,代码来源:MetaMCT.cs


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