/// <summary> /// Initializes a new instance of the <see cref="Spatial3DTreeInclusionEnumeratorBase{T}" /> class. /// </summary> /// <param name="tree"> /// The tree. /// </param> /// <exception cref="ArgumentNullException"> /// </exception> protected Spatial3DTreeInclusionEnumeratorBase([NotNull] Spatial3DTree <T> tree) { this.tree = tree ?? throw new ArgumentNullException(nameof(tree)); path = new PathEntry[64]; // It's near impossible that a path depth of 64 will ever be reached, as the max depth in the tree is 16, and more depth can only be added by growing the tree. path[0] = new PathEntry(tree.Root, -1, IsBoundsFullyInside(tree.Root.Start, tree.Root.End)); pathDepth = 1; }
public static void ShapeCast <T>([NotNull] this Spatial3DTree <T> tree, [NotNull] IShape shape, [NotNull] IList <T> result) where T : class { if (tree == null) { throw new ArgumentNullException(nameof(tree)); } if (shape == null) { throw new ArgumentNullException(nameof(shape)); } if (result == null) { throw new ArgumentNullException(nameof(result)); } var shapeEnumerator = new ShapeCastEnumerator <T>(tree, shape); while (shapeEnumerator.MoveNext()) { result.Add(shapeEnumerator.Current); } }
public MeshBuilder() { vertices = new List <VertexEntry>(); faces = new List <FaceEntry>(); edges = new List <EdgeEntry>(); spatialTree = new Spatial3DTree <VertexEntry>(); }
public MeshBuilder() { vertices = new List <VertexEntry>(); faces = new List <FaceEntry>(); edges = new List <EdgeEntry>(); spatialTree = new Spatial3DTree <VertexEntry>(); sphereCastEnumerator = new SphereCastEnumerator <VertexEntry>(spatialTree, Vector3.zero, maxDistForVertEq); }
public static void DrawTreeGizmos <T>(Spatial3DTree <T> tree) { if (tree == null) { return; } DrawTreeCellGizmos(tree.Root, 0); }
/// <summary> /// Initializes a new instance of the <see cref="Spatial3DTreeEnumerator{T}" /> class. /// </summary> /// <param name="tree"> /// The tree. /// </param> /// <exception cref="ArgumentNullException"> /// </exception> public Spatial3DTreeEnumerator([NotNull] Spatial3DTree <T> tree) { if (tree == null) { throw new ArgumentNullException("tree"); } this.tree = tree; path = new List <PathEntry>(4) { new PathEntry(tree.Root, -1) }; }
public static IList <T> SphereCast <T>([NotNull] this Spatial3DTree <T> tree, Vector3 center, float radius) where T : class { if (tree == null) { throw new ArgumentNullException(nameof(tree)); } var result = new List <T>(); var enumerator = new SphereCastEnumerator <T>(tree, center, radius); while (enumerator.MoveNext()) { result.Add(enumerator.Current); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="InverseShapeCastEnumerator{T}" /> class. /// </summary> /// <param name="tree"> /// The tree. /// </param> /// <param name="shape"> /// The shape. /// </param> public InverseShapeCastEnumerator(Spatial3DTree <T> tree, IShape shape) : base(tree) { this.shape = shape ?? throw new ArgumentNullException(); }
public InverseBoundsCastEnumerator(Spatial3DTree <T> tree, Bounds bounds) : base(tree) { this.min = bounds.min; this.max = bounds.max; }
protected Spatial3DTreeExclusionEnumeratorBase([NotNull] Spatial3DTree <T> tree) { this.tree = tree ?? throw new ArgumentNullException(nameof(tree)); path = new List <PathEntry>(4); path.Add(new PathEntry(tree.Root, -1)); }
public InverseSphereCastEnumerator(Spatial3DTree <T> tree, Vector3 center, float radius) : base(tree) { this.center = center; sqrRadius = radius * radius; }