Exemplo n.º 1
0
 public Vector3 GetRandomPosition(Random random, RegionNode node)
 {
     var n = node;
     if (n.polygon.Length != 3)
         throw new Exception("GetRandomPosition only works on regions which contains triangles only");
     return Math.RandomPointInTriangle(
         n.polygon[0],
         n.polygon[1] - n.polygon[0],
         n.polygon[2] - n.polygon[0],
         random);
 }
Exemplo n.º 2
0
        public static RegionEdge Connect(RegionNode left, RegionNode right, Vector3 pointA, Vector3 pointB)
        {
            RegionEdge e = new RegionEdge {
                PointA = pointA, PointB = pointB
            };

            e.Left  = left;
            e.Right = right;
            e.Left.Edges.Add(e.Right, e);
            e.Right.Edges.Add(e.Left, e);
            return(e);
        }
Exemplo n.º 3
0
        public Vector3 GetRandomPosition(Random random, RegionNode node)
        {
            var n = node;

            if (n.polygon.Length != 3)
            {
                throw new Exception("GetRandomPosition only works on regions which contains triangles only");
            }
            return(Math.RandomPointInTriangle(
                       n.polygon[0],
                       n.polygon[1] - n.polygon[0],
                       n.polygon[2] - n.polygon[0],
                       random));
        }
Exemplo n.º 4
0
 public float Distance(RegionNode node)
 {
     return((node.Center - Center).Length());
 }
Exemplo n.º 5
0
 public float Distance(RegionNode node)
 {
     return (node.Center - Center).Length();
 }
Exemplo n.º 6
0
 public static RegionEdge Connect(RegionNode left, RegionNode right, Vector3 pointA, Vector3 pointB)
 {
     RegionEdge e = new RegionEdge { PointA = pointA, PointB = pointB };
     e.Left = left;
     e.Right = right;
     e.Left.Edges.Add(e.Right, e);
     e.Right.Edges.Add(e.Left, e);
     return e;
 }