Ejemplo n.º 1
0
        public bool ClosestPointOnSurf

            (

            FeatureUpdateContext updateContext,
            [DefaultExpression("baseCS")]                CoordinateSystem cs,
            [Replicatable]                              IPoint point,
            [Replicatable]                              BSplineSurface surf,
            [DefaultValue(0.01)]                        double tol,
            [Out]                                       ref Point CPpoint,
            [Out]                                       ref double Dist,
            [Out]                                       ref DVector3d Normal


            )
        {

            this.LetConstituentFeaturesBeDirectlyIndexible();
            this.DeleteConstituentFeatures(updateContext);

            Point2d tempPt;

            DPoint3d dp = CerverFunctions.closestPointOnSurf(point.DPoint3d, surf, tol, out Dist, out tempPt, out Normal);

            Point outPt = new Point(this);
            outPt.FromDPoint3d(updateContext, cs, dp);
            outPt.SetSuccess(true);
            AddConstituentFeature(outPt);
            
            CPpoint = outPt;

            return true;
        } 
Ejemplo n.º 2
0
        public bool MeshConnectedVerticies

            (
            FeatureUpdateContext updateContext,
            [DefaultExpression("baseCS")]                CoordinateSystem cs,
                                                                     Mesh mesh,
            [Replicatable]                                         IPoint SearchPoint,
            [DefaultValue(false)]                                    bool generatePoints,
            [Out]                                       ref int[] ConnectedVtxID,
            [Out]                                       ref Point[] ConnectedVtx,
            [Out]                                       ref DPoint3d[] DConnectedVtx

            )
        {

            this.LetConstituentFeaturesBeDirectlyIndexible();
            this.DeleteConstituentFeatures(updateContext);

            //System.Diagnostics.Stopwatch stp = new Stopwatch();

           // stp.Start();
            DPoint3d[] cntVtx = mesh.ConnectedVtx(SearchPoint.DPoint3d, out ConnectedVtxID);
            DConnectedVtx = cntVtx;
           // Feature.Print("area 1 " + stp.ElapsedMilliseconds.ToString());
           // stp.Reset();

            if (generatePoints)
            {
                List<Point> vtx = new List<Point>(cntVtx.Length);

                foreach (var v in cntVtx)
                {
                    Point p = new Point(this);
                    p.FromDPoint3d(updateContext, cs, v);
                    p.SetSuccess(true);
                    vtx.Add(p);

                }
                this.AddReplicatedChildFeatures(ConnectedVtx);
                ConnectedVtx = vtx.ToArray();
            }
           // Feature.Print("area 2 " + stp.ElapsedMilliseconds.ToString());
           // stp.Stop();

            return true;
        }