コード例 #1
0
        private void SetWarningGeometry()
        {
            var c = CaveTools.GetPlanarPanelBoundary(panelFrame);

            parameters.problemPanels.Add(c);
            RhinoDoc.ActiveDoc.Objects.AddCurve(c);
            return;
        }
コード例 #2
0
ファイル: PanelFrame.cs プロジェクト: rolyhudson/CaveSystemDD
        private void FindMeshNodes()
        {
            NurbsCurve boundary = CaveTools.GetPlanarPanelBoundary(this);

            for (int c = 0; c < nodeGrid.Count; c++)
            {
                List <Curve> row = new List <Curve>();
                for (int d = 0; d < nodeGrid[c].Count; d++)
                {
                    Ray3d  ray = new Ray3d(nodeGrid[c][d], localPlane.ZAxis);
                    double t   = Rhino.Geometry.Intersect.Intersection.MeshRay(CavePanels, ray);
                    if (t >= 0)
                    {
                        meshnodes[c][d].point    = ray.PointAt(t);
                        meshnodes[c][d].pointset = true;
                        //is it too close to edge
                        double p = 0;
                        boundary.ClosestPoint(nodeGrid[c][d], out p);
                        Point3d boundaryPt = boundary.PointAt(p);
                        double  dist       = nodeGrid[c][d].DistanceTo(boundaryPt);
                        if (dist < parameters.cellGap / 2 - 5)
                        {
                            ghostNodesFound         = true;
                            meshnodes[c][d].isGhost = true;
                        }
                    }
                    else
                    {
                        Polyline[] edges   = CavePanels.GetNakedEdges();
                        double     minDist = double.MaxValue;
                        Point3d    closest = new Point3d();
                        Line       drop    = new Line(nodeGrid[c][d], localPlane.Normal, 1000);
                        Point3d    meshPt  = new Point3d();
                        foreach (Polyline pl in edges)
                        {
                            foreach (Point3d pt in pl)
                            {
                                Point3d temp = drop.ClosestPoint(pt, false);
                                if (temp.DistanceTo(pt) < minDist)
                                {
                                    minDist = temp.DistanceTo(pt);
                                    closest = temp;
                                    meshPt  = pt;
                                }
                            }
                        }
                        meshnodes[c][d].point    = closest;
                        meshnodes[c][d].pointset = true;
                        meshnodes[c][d].isGhost  = true;
                        ghostNodesFound          = true;
                        //RhinoDoc.ActiveDoc.Objects.AddPoint(meshnodes[c][d].point);
                    }
                }
            }
        }