(from: MotionPoint, to: MotionPoint, sign: number)
| 173 | * sondern ein Koerper, der kurz naeher steht. |
| 174 | */ |
| 175 | export function controlPointOf(from: MotionPoint, to: MotionPoint, sign: number): MotionPoint { |
| 176 | const dx = to.x - from.x; |
| 177 | const dy = to.y - from.y; |
| 178 | const length = Math.hypot(dx, dy); |
| 179 | const midX = (from.x + to.x) / 2; |
| 180 | const midY = (from.y + to.y) / 2; |
| 181 | const midZ = (from.z + to.z) / 2; |
| 182 | if (length === 0) { |
| 183 | return { x: midX, y: midY, z: midZ }; |
| 184 | } |
| 185 | const offset = TRANSITION_BEND * length * sign; |
| 186 | return { |
| 187 | x: midX + (-dy / length) * offset, |
| 188 | y: midY + (dx / length) * offset, |
| 189 | z: midZ, |
| 190 | }; |
| 191 | } |
| 192 | |
| 193 | /** Ein Punkt der Bahn, bei `t` zwischen 0 und 1. Quadratische Bezierkurve. */ |
| 194 | export function transitionPointAt( |
no outgoing calls
no test coverage detected