public TemporaryVertex(EdgePlacerBehavior be) { _behavior = be; var target = _behavior.Target; var myPosition = _behavior.Holder.GetPosition(); _behavior._vertices.Add(_behavior.CreateVertex(target.Entity != null && Vector3D.DistanceSquared(myPosition, target.Position) < ClickDistSq ? target.Position : myPosition)); EdgePlacerSystem.AnnotateNodes(_behavior.Graph, _behavior._vertices); }
public LongPlanData(EdgePlacerBehavior epa, EdgePlacerSystem.AnnotatedNode first, EdgePlacerSystem.AnnotatedNode last) { epa._vertices.Clear(); epa._vertices.Add(first); epa._vertices.Add(last); M1 = epa.ComputeVertexMatrix(first, 0); M2 = epa.ComputeVertexMatrix(last, 1); Curve = PrepareSphericalBez(M1, M2); var length = Curve.LengthAuto(epa.PlacedDefinition.Distance.Min / 8); Length = length; var minCount = (int)Math.Ceiling(length / epa.PlacedDefinition.Distance.Max); var maxCount = (int)Math.Floor(length / epa.PlacedDefinition.Distance.Min); var idealCount = (int)Math.Round(length / epa.PlacedDefinition.PreferredDistance); Count = MathHelper.Clamp(idealCount, minCount, maxCount); }