예제 #1
0
        public static bool IsCross(this MathPlane plane, MathLine line, ref Vector3 position)
        {
            var  dot    = Vector3.Dot(plane.Normal, line.Direction);
            bool result = dot != 0;

            if (result)
            {
                var d = Vector3.Dot(plane.GetPointOnPlane() - line.Point, plane.Normal) / dot;
                position = d * line.Direction + line.Point;
            }
            return(result);
        }
예제 #2
0
        public static bool IsCross(this MathCube cube, MathLine line, List <Vector3> postionList)
        {
            var  planeList = cube.GetPlanes();
            var  position  = new Vector3();
            bool result    = false;

            foreach (var plane in planeList)
            {
                if (plane.IsCross(line, ref position))
                {
                    postionList.Add(position);
                    result = true;
                }
            }
            return(result);
        }
예제 #3
0
 public static Vector3 GetPointOnLine(this MathLine line)
 {
     return(line.Point + (float)MathTool.Random() * line.Direction);
 }
예제 #4
0
        public static MathLine CreateLine(Vector3 v1, Vector3 v2)
        {
            MathLine line = new MathLine();

            return(line);
        }