コード例 #1
0
        private MasterGeoObj[] checkSphereSphere(AbstractSphere abstractSphere1, AbstractSphere abstractSphere2)
        {
            intersectionFigData data = IntersectionMath.SphereSphereIntersection(abstractSphere1, abstractSphere2);

            Debug.Log("Data produces " + data.figtype.ToString());
            Debug.Log("Point Value " + data.vectordata[0].ToString());

            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[2]);
                DependentCircle newCircle = GeoObjConstruction.dCircle(centerPoint, edgePoint, data.vectordata[1]);
                mgoResult = new MasterGeoObj[] { centerPoint.setIntersectionFigure(0), edgePoint.setIntersectionFigure(0), newCircle.setIntersectionFigure(0) };
            }
            else if (data.figtype == GeoObjType.point)
            {
                mgoResult = new MasterGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]) };
            }
            return(mgoResult);
        }
コード例 #2
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);
        }
コード例 #3
0
        private void updateSphereLine(MasterGeoObj mgo, MasterGeoObj masterGeoObj1, MasterGeoObj masterGeoObj2)
        {
            intersectionFigData data = IntersectionMath.SphereLineIntersection(masterGeoObj1.GetComponent <AbstractSphere>(), masterGeoObj2.GetComponent <straightEdgeBehave>());

            if (data.figtype == mgo.figType)
            {
                //point or points;
                if (data.vectordata.Length > 1)
                {
                    mgo.Position3 = data.vectordata[mgo.intersectionMultipleIDX];
                }
                else
                {
                    mgo.Position3 = data.vectordata[0];
                }
            }
            else if (data.figtype == GeoObjType.none)
            {
                mgo.DeleteGeoObj();
            }
            else
            {
                Debug.LogWarning("TYPE MISMATCH");
            }
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
        private AbstractGeoObj[] checkStraightedgeStraightedge(straightEdgeBehave straightEdgeBehave1, straightEdgeBehave straightEdgeBehave2)
        {
            intersectionFigData data = IntersectionMath.LineLineIntersection(straightEdgeBehave1, straightEdgeBehave2);

            AbstractGeoObj[] mgoResult = null;
            if (data.figtype == GeoObjType.point)
            {
                mgoResult = new AbstractGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0) };
            }
            return(mgoResult);
        }
コード例 #7
0
        private MasterGeoObj[] checkSphereStraightEdge(AbstractSphere abstractSphere, straightEdgeBehave straightEdgeBehave)
        {
            intersectionFigData data = IntersectionMath.SphereLineIntersection(abstractSphere, straightEdgeBehave);

            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);
        }
コード例 #8
0
        private MasterGeoObj[] CheckCircleCircle(AbstractCircle abstractCircle1, AbstractCircle abstractCircle2)
        {
            intersectionFigData data = IntersectionMath.CircleCircleIntersection(abstractCircle1, abstractCircle2);

            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);
        }
コード例 #9
0
        private AbstractGeoObj[] checkSpherecircle(AbstractSphere abstractSphere, AbstractCircle abstractCircle)
        {
            intersectionFigData data = IntersectionMath.SphereCircleIntersection(abstractSphere, abstractCircle);

            AbstractGeoObj[] mgoResult = null;
            if (data.figtype == GeoObjType.point)
            {
                if (data.vectordata.Length == 1)
                {
                    mgoResult = new AbstractGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0) };
                }
                else if (data.vectordata.Length == 2)
                {
                    mgoResult = new AbstractGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0), GeoObjConstruction.dPoint(data.vectordata[1]).setIntersectionFigure(1) };
                }
            }
            return(mgoResult);
        }
コード例 #10
0
        private AbstractGeoObj[] checkCircleFlatface(AbstractCircle abstractCircle, flatfaceBehave flatfaceBehave)
        {
            intersectionFigData data = IntersectionMath.CirclePlaneIntersection(abstractCircle, flatfaceBehave);

            AbstractGeoObj[] mgoResult = null;
            if (data.figtype == GeoObjType.point)
            {
                if (data.vectordata.Length == 1)
                {
                    mgoResult = new AbstractGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0) };
                }
                else if (data.vectordata.Length == 2)
                {
                    mgoResult = new AbstractGeoObj[] { GeoObjConstruction.dPoint(data.vectordata[0]).setIntersectionFigure(0), GeoObjConstruction.dPoint(data.vectordata[1]).setIntersectionFigure(1) };
                }
            }
            return(mgoResult);
        }
コード例 #11
0
        private void updatePlanePlane(MasterGeoObj mgo, MasterGeoObj masterGeoObj1, MasterGeoObj masterGeoObj2)
        {
            intersectionFigData data = IntersectionMath.PlanePlaneIntersection(masterGeoObj1.GetComponent <flatfaceBehave>(), masterGeoObj2.GetComponent <flatfaceBehave>());

            if (data.figtype == mgo.figType)
            {
                //line only option
                mgo.Position3 = data.vectordata[0];
                mgo.AddToRManager();
            }
            else if (data.figtype == GeoObjType.none)
            {
                mgo.DeleteGeoObj();
            }
            else
            {
                Debug.LogWarning("TYPE MISMATCH");
            }
        }
コード例 #12
0
        private void updatePlaneLine(AbstractGeoObj mgo, AbstractGeoObj AbstractGeoObj1, AbstractGeoObj AbstractGeoObj2)
        {
            intersectionFigData data = IntersectionMath.LinePlaneIntersection(AbstractGeoObj1.GetComponent <flatfaceBehave>(), AbstractGeoObj2.GetComponent <straightEdgeBehave>());

            if (data.figtype == mgo.figType)
            {
                //point only option;
                mgo.Position3 = data.vectordata[0];
                mgo.AddToRManager();
            }
            else if (data.figtype == GeoObjType.none)
            {
                mgo.DeleteGeoObj();
            }
            else
            {
                Debug.LogWarning("TYPE MISMATCH");
            }
        }
コード例 #13
0
        private void updateCircleLine(MasterGeoObj mgo, MasterGeoObj masterGeoObj1, MasterGeoObj masterGeoObj2)
        {
            intersectionFigData data = IntersectionMath.CircleLineIntersection(masterGeoObj1.GetComponent <AbstractCircle>(), masterGeoObj2.GetComponent <straightEdgeBehave>());

            if (data.figtype == mgo.figType)
            {
                switch (data.figtype)
                {
                case GeoObjType.point:
                    mgo.Position3 = data.vectordata[0];
                    mgo.AddToRManager();
                    break;

                case GeoObjType.circle:
                    DependentCircle circle = mgo.GetComponent <DependentCircle>();
                    circle.centerPos        = data.vectordata[0];
                    circle.normalDir        = data.vectordata[1];
                    circle.center.Position3 = data.vectordata[0];
                    circle.edgePos          = data.vectordata[2];
                    circle.edge.Position3   = data.vectordata[2];
                    circle.AddToRManager();
                    circle.edge.AddToRManager();
                    circle.center.AddToRManager();
                    break;

                default:
                    break;
                }
            }
            else if (data.figtype == GeoObjType.none)
            {
                mgo.DeleteGeoObj();
            }
            else
            {
                Debug.LogWarning("TYPE MISMATCH");
            }
        }
コード例 #14
0
        private void updateCirclePlane(MasterGeoObj mgo, MasterGeoObj masterGeoObj1, MasterGeoObj masterGeoObj2)
        {
            intersectionFigData data = IntersectionMath.CirclePlaneIntersection(masterGeoObj1.GetComponent <AbstractCircle>(), masterGeoObj2.GetComponent <flatfaceBehave>());

            if (data.figtype == mgo.figType)
            {
                if (data.vectordata.Length > 1)
                {
                    mgo.Position3 = data.vectordata[mgo.intersectionMultipleIDX];
                }
                else
                {
                    mgo.Position3 = data.vectordata[0];
                }
            }
            else if (data.figtype == GeoObjType.none)
            {
                mgo.DeleteGeoObj();
            }
            else
            {
                Debug.LogWarning("TYPE MISMATCH");
            }
        }