Example #1
0
        private MasterGeoObj[] checkSphereFlatface(AbstractSphere abstractSphere, flatfaceBehave flatfaceBehave)
        {
            intersectionFigData data = IntersectionMath.SpherePlaneIntersection(abstractSphere, flatfaceBehave);

            MasterGeoObj[] mgoResult = null;
            if (data.figtype == GeoObjType.circle)
            {
                DependentPoint centerPoint     = GeoObjConstruction.dPoint(data.vectordata[0]);
                Vector3        radiusDirection = Vector3.up;
                if (Vector3.Cross(radiusDirection, data.vectordata[1]).magnitude == 0)
                {
                    radiusDirection = Vector3.right;
                }
                radiusDirection = Vector3.Cross(data.vectordata[1], radiusDirection).normalized;

                DependentPoint  edgePoint = GeoObjConstruction.dPoint(data.vectordata[0] + data.floatdata[0] * radiusDirection);
                DependentCircle newCircle = GeoObjConstruction.dCircle(centerPoint, edgePoint, data.vectordata[1]);
                mgoResult = new MasterGeoObj[] { centerPoint.setIntersectionFigure(0), edgePoint.setIntersectionFigure(1), newCircle.setIntersectionFigure(2) };
            }
            else if (data.figtype == GeoObjType.point)
            {
                mgoResult = new MasterGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]) };
            }
            return(mgoResult);
        }
Example #2
0
        private MasterGeoObj[] checkFlatfaceFlatface(flatfaceBehave flatfaceBehave1, flatfaceBehave flatfaceBehave2)
        {
            intersectionFigData data = IntersectionMath.PlanePlaneIntersection(flatfaceBehave1, flatfaceBehave2);

            MasterGeoObj[] mgoResult = null;
            if (data.figtype == GeoObjType.line)
            {
                Debug.LogWarning("Need to Construct Line");
            }
            return(mgoResult);
        }
Example #3
0
        private MasterGeoObj[] checkFlatfaceStraightedge(flatfaceBehave flatfaceBehave, straightEdgeBehave straightEdgeBehave)
        {
            intersectionFigData data = IntersectionMath.LinePlaneIntersection(flatfaceBehave, straightEdgeBehave);

            MasterGeoObj[] mgoResult = null;
            if (data.figtype == GeoObjType.point)
            {
                mgoResult = new MasterGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0) };
            }
            return(mgoResult);
        }
Example #4
0
        private MasterGeoObj[] checkCircleFlatface(AbstractCircle abstractCircle, flatfaceBehave flatfaceBehave)
        {
            intersectionFigData data = IntersectionMath.CirclePlaneIntersection(abstractCircle, flatfaceBehave);

            MasterGeoObj[] mgoResult = null;
            if (data.figtype == GeoObjType.point)
            {
                if (data.vectordata.Length == 1)
                {
                    mgoResult = new MasterGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0) };
                }
                else if (data.vectordata.Length == 2)
                {
                    mgoResult = new MasterGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0), GeoObjConstruction.dPoint(data.vectordata[1]).setIntersectionFigure(1) };
                }
            }
            return(mgoResult);
        }
Example #5
0
 internal static intersectionFigData SegmentPlaneIntersection(AbstractLineSegment line, flatfaceBehave plane)
 {
     return(SegmentPlaneIntersection(line.vertex0, line.vertex1, plane.Position3, plane.normalDir));
 }
Example #6
0
 /// <summary>
 /// Finds the point of intersection between a flatface and a straightedge
 /// </summary>
 /// <param name="plane"></param>
 /// <param name="line"></param>
 /// <returns></returns>
 internal static intersectionFigData LinePlaneIntersection(flatfaceBehave plane, straightEdgeBehave line)
 {
     return(LinePlaneIntersection(line.center, line.normalDir, plane.Position3, plane.normalDir));
 }
Example #7
0
 internal static intersectionFigData PlanePlaneIntersection(flatfaceBehave plane1, flatfaceBehave plane2)
 {
     return(PlanePlaneIntersection(plane1.Position3, plane1.normalDir, plane2.Position3, plane2.normalDir));
 }
Example #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="circle"></param>
 /// <param name="flatface"></param>
 /// <returns></returns>
 internal static intersectionFigData CirclePlaneIntersection(AbstractCircle circle, flatfaceBehave flatface)
 {
     return(CirclePlaneIntersection(circle, flatface.Position3, flatface.normalDir));
 }
Example #9
0
 internal static intersectionFigData SpherePlaneIntersection(AbstractSphere sphere, flatfaceBehave flatface)
 {
     return(SpherePlaneIntersection(sphere, flatface.Position3, flatface.normalDir));
 }