Beispiel #1
0
        public static PlanarFace FurthestFace(XYZ point, XYZ direction, IList <PlanarFace> listFaces, Transform transform)
        {
            PlanarFace result     = null;
            double     num        = double.MinValue;
            PLane3D    plane3DLib = new PLane3D(point, direction);

            foreach (PlanarFace planarFace in listFaces)
            {
                XYZ  xyz  = transform.OfVector(planarFace.FaceNormal);
                XYZ  xyz2 = direction.CrossProduct(xyz);
                bool flag = xyz2.GetLength() > 0.001 || xyz.DotProduct(direction) < 0.0;
                if (!flag)
                {
                    double num2  = plane3DLib.DistanceFromPointToPlane(transform.OfPoint(planarFace.Origin));
                    bool   flag2 = num2 < 0.001;
                    if (!flag2)
                    {
                        bool flag3 = num2 > num;
                        if (flag3)
                        {
                            result = planarFace;
                            num    = num2;
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #2
0
        public static PlanarFace FurthestFace(PlanarFace face, IList <PlanarFace> listFaces, Transform transform)
        {
            PlanarFace result     = null;
            double     num        = double.MinValue;
            XYZ        xyz        = transform.OfVector(face.FaceNormal);
            XYZ        xyz2       = transform.OfPoint(face.Origin);
            PLane3D    plane3DLib = new PLane3D(transform.OfPoint(face.Origin), transform.OfVector(face.FaceNormal));

            foreach (PlanarFace planarFace in listFaces)
            {
                XYZ  source = transform.OfVector(planarFace.FaceNormal);
                XYZ  xyz3   = xyz.CrossProduct(source);
                bool flag   = xyz3.GetLength() > 0.001;
                if (!flag)
                {
                    double num2  = plane3DLib.DistanceFromPointToPlane(transform.OfPoint(planarFace.Origin));
                    bool   flag2 = num2 < 0.001;
                    if (!flag2)
                    {
                        bool flag3 = num2 > num;
                        if (flag3)
                        {
                            result = planarFace;
                            num    = num2;
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #3
0
        public static double PointToFace(XYZ point, PlanarFace face, Transform transform)
        {
            XYZ     normal     = transform.OfVector(face.FaceNormal);
            XYZ     origin     = transform.OfPoint(face.Origin);
            PLane3D plane3DLib = new PLane3D(origin, normal);

            return(plane3DLib.DistanceFromPointToPlane(point));
        }