예제 #1
0
        public static CoordSys GramSchmidt(CameraSpacePoint first, CameraSpacePoint sec, CameraSpacePoint third, CameraSpacePoint center)
        {
            CameraSpacePoint secNew   = first.ProjOperator(sec).SubtractFrom(sec);
            CameraSpacePoint thirdNew = secNew.ProjOperator(third).Add(first.ProjOperator(third)).SubtractFrom(third);

            //float res1 = first.DotProduct(secNew);
            //float res2 = first.DotProduct(thirdNew);
            //float res3 = secNew.DotProduct(thirdNew);

            return(new CoordSys()
            {
                Center = center, Top = center.Add(secNew),
                Front = center.Add(first),
                Side = center.Add(thirdNew)
            });
        }
예제 #2
0
        public static CoordSys NewCoordSys(CoordSys coordSys)
        {
            CoordSys newCoord = new CoordSys()
            {
                Center = coordSys.Center, Top = coordSys.Top, Side = coordSys.Side, Front = coordSys.Front
            };

            newCoord.Side.Y = coordSys.Center.Y;
            newCoord.Top.X  = coordSys.Center.X;

            CameraSpacePoint transSideN  = newCoord.Center.SubtractFrom(newCoord.Side);
            CameraSpacePoint transFrontN = newCoord.Center.SubtractFrom(newCoord.Front);
            CameraSpacePoint transTopN   = newCoord.Center.SubtractFrom(newCoord.Top);

            transFrontN = transSideN.CrossProduct(transTopN);

            newCoord.Top   = transTopN.Add(coordSys.Center);
            newCoord.Side  = transSideN.Add(coordSys.Center);
            newCoord.Front = transFrontN.Add(coordSys.Center);
            //newCoord.Front = newCoord.Side.CrossProduct(newCoord.Top);
            //newCoord.Front.X = coordSys.Center.X;
            //newCoord.Front.Y = coordSys.Center.Y;

            return(newCoord);
        }