Exemple #1
0
 public static Vector2d Convert2d(this Vector3d vec)
 {
     using (var plane = new Plane())
     {
         return(vec.Convert2d(plane));
     }
 }
Exemple #2
0
        getSegNo(Point3d varPnt, List <Point3d> var2dCoords)
        {
            int numSeg = 0;

            for (int s = 1; s < var2dCoords.Count; s++)
            {
                Point3d pnt3dBeg = var2dCoords[s - 1];
                Point3d pnt3dEnd = var2dCoords[s - 0];

                double dblLen1 = pnt3dBeg.getDistance(pnt3dEnd);
                double dblLen2 = varPnt.getDistance(pnt3dBeg);

                Vector3d v3d1 = pnt3dEnd - pnt3dBeg;
                Vector3d v3d2 = varPnt - pnt3dBeg;

                Vector2d v2d1 = v3d1.Convert2d(BaseObjs.xyPlane);
                Vector2d v2d2 = v3d2.Convert2d(BaseObjs.xyPlane);

                double dblResult = v2d1.DotProduct(v2d2);

                //test if point is on line with same direction as boundary segment

                if (System.Math.Round(dblResult, 3) == 0.0)                   //test if point is on segment
                {
                    if (dblLen2 <= dblLen1)
                    {
                        double dblAng1 = pnt3dBeg.getDirection(pnt3dEnd);
                        double dblAng2 = pnt3dBeg.getDirection(varPnt);

                        if (System.Math.Round(dblAng2, 3) == System.Math.Round(dblAng1, 3))
                        {
                            numSeg = s - 1;
                        }
                    }
                }
            }
            return(numSeg);
        }
Exemple #3
0
 public static Polyline?CreateRectangle(this Point3d pt, double length, double width, CellAlignment alignment,
                                        Vector3d dir)
 {
     return(CreateRectangle(pt.Convert2d(), length, width, alignment, dir.Convert2d()));
 }