Gets the angle between two vectors in the range 0..1 Parameters: base - the start of both vectors v0,v1 - the end points of the two vectors normal - the surface normal of the face these verts lie in Returns the cosine of the angle between and
| 2445 | // normal - the surface normal of the face these verts lie in |
| 2446 | // Returns the cosine of the angle between <base,v0> and <base,v1> |
| 2447 | float GetAngle(vector *base, vector *v0, vector *v1, vector *normal) { |
| 2448 | vector edge0, edge1, cross; |
| 2449 | float dot; |
| 2450 | |
| 2451 | vm_GetNormalizedDir(&edge0, v0, base); |
| 2452 | vm_GetNormalizedDir(&edge1, v1, base); |
| 2453 | |
| 2454 | dot = edge0 * edge1; |
| 2455 | cross = edge0 ^ edge1; |
| 2456 | |
| 2457 | if (cross * *normal > 0) |
| 2458 | return 0.25 - dot / 4.0; |
| 2459 | else |
| 2460 | return 0.75 + dot / 4.0; |
| 2461 | } |
| 2462 | |
| 2463 | // Connects two rooms in a pleasing way |
| 2464 | void BuildSmoothBridge(room *rp0, int facenum0, room *rp1, int facenum1) { |
no test coverage detected