コード例 #1
0
        public static GH_Surface ProjectSurfaceToTopoFast(Mesh topoMesh, Surface featureSurface)
        {
            GH_Surface   ghSurface = new GH_Surface();
            NurbsSurface surface   = featureSurface.ToNurbsSurface();

            ///Move patch verts to topo
            for (int u = 0; u < surface.Points.CountU; u++)
            {
                for (int v = 0; v < surface.Points.CountV; v++)
                {
                    Point3d controlPt;
                    surface.Points.GetPoint(u, v, out controlPt);
                    Ray3d  ray = new Ray3d(controlPt, moveDir);
                    double t   = Rhino.Geometry.Intersect.Intersection.MeshRay(topoMesh, ray);

                    if (t >= 0.0)
                    {
                        surface.Points.SetPoint(u, v, ray.PointAt(t));
                    }
                    else
                    {
                        Ray3d  rayOpp = new Ray3d(controlPt, -moveDir);
                        double tOpp   = Rhino.Geometry.Intersect.Intersection.MeshRay(topoMesh, rayOpp);
                        if (tOpp >= 0.0)
                        {
                            surface.Points.SetPoint(u, v, rayOpp.PointAt(t));
                        }
                        else
                        {
                            //return null;
                        }
                    }
                }
            }
            if (surface.IsValid)
            {
                GH_Convert.ToGHSurface(surface, GH_Conversion.Primary, ref ghSurface);
                return(ghSurface);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        /*******************************************/

        public static bool CastToGoo(object value, ref GH_Surface target)
        {
            return(GH_Convert.ToGHSurface(value, GH_Conversion.Both, ref target));
        }