3: 2015-03-30 (月) 03:42:37 osinko |
現: - no date - |
- | TITLE:正射影 | |
- | #jsmath | |
- | #contents | |
- | **正射影 [#ad6e31b3] | |
- | \(\mathbf{a}\)に\(\mathbf{b}\)を射影した\(\mathbf{p}\)を求めたい。この場合の射影ベクトルを求める式は以下になる | |
- | &font(Red){\(\mathbf{ p }=\frac { \mathbf{a}\cdot \mathbf{b} }{ \mathbf{a}\cdot \mathbf{a} } \mathbf{a}\)}; | |
| | | |
- | #code(csharp){{ | |
- | using UnityEngine; | |
- | using System.Collections; | |
- | | |
- | public class projection1 : MonoBehaviour | |
- | { | |
- | Vector3 a, b, proj, proj2; | |
- | | |
- | void Start () | |
- | { | |
- | a = new Vector3 (10, 4); | |
- | b = new Vector3 (3, 7); | |
- | | |
- | proj = Vector3.Project (b, a); | |
- | proj2 = (Vector3.Dot (a, b) / Vector3.Dot (a, a)) * a; | |
- | | |
- | print ("正射影unity標準機能=" + proj + " 正射影自分で計算=" + proj2); | |
- | } | |
- | } | |
- | }} | |
- | | |
- | **証明 [#ndfd6147] | |