public TraversalLine GetMiddleLineForCurrentGenerator(TraversalGenerator generator) { for (int i = 0; i < generator.TraversalLines.Length; i++) { if (generator.TraversalLines[i].vertex.Equals(generator.MiddleVertex)) { return(generator.TraversalLines[i]); } } return(null); }
// Add a new traversal line the the holder, also add the generator to the holder public void AddTraversalLines(TraversalGenerator generators) { List <TraversalLine> collectedLines = new List <TraversalLine>(); collectedLines.AddRange(traversalLines); collectedLines.AddRange(generators.TraversalLines); traversalLines = collectedLines.ToArray(); List <TraversalGenerator> collectedGenerators = new List <TraversalGenerator>(); collectedGenerators.AddRange(this.generators); collectedGenerators.Add(generators); this.generators = collectedGenerators.ToArray(); OnValueUpdated?.Invoke(); }
private float DistanceToGenerator(Vector3 pos, TraversalGenerator gen) { return(Mathf.Pow(pos.x - gen.MiddleVertex.Position.x, 2) + Mathf.Pow(pos.y - gen.MiddleVertex.Position.y, 2) + Mathf.Pow(pos.z - gen.MiddleVertex.Position.z, 2)); }
public void AddTraversalGraph(TraversalGenerator traversalGenerator) { AddTraversalLines(traversalGenerator); }