Vector a is a 2D vector with x component 3 and y component 5. Vector b is a 2D vector with x component 2 and y component -1. Adding a and b results in vector c, a 2D vector with x component 5 and y component 4. The relation of the three vectors to the origin point forms a scalene triangle.
2D vector a is subtracted from 2D vector b resulting in a 2D vector with x component 5 and y component 4. This is illustrated as a single line with directional arrow from point a to point b.
// The vector d has the same magnitude as c but points in the opposite direction.var c = b - a;var d = a - b;
数値と同様に、Vector の負の値の加算は、正の値の減算と同じです。
// These both give the same result.var c = a - b;var c = a + -b;
Two 2D vectors represented as directional lines extend from the same origin point. Vector a extends straight upward with a positive y component but no x component. Vector b extends upward by a smaller y component than vector a and to the right with a positive x component. A line describing the region of the y axis covered by both vectors is labelled as a multiplied by b.
A series of vectors radiate out at angles between 0 and 180 degrees from a reference vector. Between 0 and 90 degrees from the reference vector, the dot product is between 1 and 0, and decreases as the angle increases. Between 90 and 180 degrees from the reference vector, the dot product is between 0 and -1, and decreases as the angle increases.
ドット積は余弦を計算するよりも数学的に簡単な演算です。そのため、状況によっては
Mathf.Cos
関数や Vector magnitude 演算の代わりに使用できます (まったく同じ働きをするわけではありませんが、同等のエフェクトが得られる場合もあります)。ただし、ドット積機能の計算は CPU 時間をはるかに短縮するため、有用な最適化になります。
A series of vectors radiate out at angles between 0 and 180 degrees from a reference vector. Between 0 and 90 degrees from the reference vector, the cross product is between 0 and 1, and increases as the angle increases. Between 90 and 180 degrees from the reference vector, the cross product is between 1 and 0, and decreases as the angle increases.
Three points; a, b, and c, in 3D coordinate space form the corner points of a triangle. Vector subtraction of b and c from a gives the long sides of the triangle, side 1 from a to b, and side 2 from a to b. The cross product of the vectors side 1 and side 2 gives a new vector perpendicular to the plane on which the three original points lie.
Vector3 a;Vector3 b;Vector3 c;Vector3 side1 = b - a;Vector3 side2 = c - a;Vector3 normal = Vector3.Cross(side1, side2);
A left hand demonstrates the left hand rule for determining the input order of vectors for calculating a cross product. The forefinger and thumb are extended at right angles to one another while the middle finger stretches out in a third plane at right angles to the forefinger. The forefinger and thumb represent the first and second input vectors to the cross product calculation respectively. The middle finger represents the resulting normal.