public IEnumerable <NodeConnection> GetSubdividedConnection() { var direction = End - Start; var subdivideCount = direction.Length(); var directionNormalized = direction.Normalized(); for (int i = 0; i < subdivideCount; i++) { var subConnectionStart = Start + directionNormalized * i; var subConnectionEnd = Start + directionNormalized * (i + 1); var subConnection = new NodeConnection(subConnectionStart, subConnectionEnd); yield return(subConnection); } }
public void UpdatePreview(NodeConnection nodeConnection) { if (!nodeConnection.Equals(_lastPreviewConnection)) { RemovePreview(); var subConnections = nodeConnection.GetSubdividedConnection(); foreach (var subConnection in subConnections) { AddPreview(CreateNodeConnectionView(subConnection)); } } _lastPreviewConnection = nodeConnection; }
public bool Equals(NodeConnection other) { return (Start.Equals(other.Start) && End.Equals(other.End) || Start.Equals(other.End) && End.Equals(other.Start)); }
private static Quaternion GetRotationFromConnectionEnd(NodeConnection connection) { return(Quaternion.FromToRotation(Vector3.forward, (connection.End - connection.Start).ToV3())); }