ProjectOnVector sets this vector to its projection on other vector. Returns the pointer to this updated vector.
(other *Vector3)
| 543 | // ProjectOnVector sets this vector to its projection on other vector. |
| 544 | // Returns the pointer to this updated vector. |
| 545 | func (v *Vector3) ProjectOnVector(other *Vector3) *Vector3 { |
| 546 | |
| 547 | var on Vector3 |
| 548 | on.Copy(other).Normalize() |
| 549 | dot := v.Dot(&on) |
| 550 | return v.Copy(&on).MultiplyScalar(dot) |
| 551 | } |
| 552 | |
| 553 | // ProjectOnPlane sets this vector to its projection on the plane |
| 554 | // specified by its normal vector. |
no test coverage detected