コード例 #1
0
        private MasterGeoObj[] checkSpherecircle(AbstractSphere abstractSphere, AbstractCircle abstractCircle)
        {
            intersectionFigData data = IntersectionMath.SphereCircleIntersection(abstractSphere, abstractCircle);

            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);
        }
コード例 #2
0
        private void updateSphereCircle(MasterGeoObj mgo, MasterGeoObj masterGeoObj1, MasterGeoObj masterGeoObj2)
        {
            intersectionFigData data = IntersectionMath.SphereCircleIntersection(masterGeoObj1.GetComponent <AbstractSphere>(), masterGeoObj2.GetComponent <AbstractCircle>());

            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");
            }
        }