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); }
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); }
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)); }
public float Distance(RegionNode node) { return((node.Center - Center).Length()); }
public float Distance(RegionNode node) { return (node.Center - Center).Length(); }
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; }