Debian Codegraph @

doc/man/man3/ivm/basics/SbVec2f.ivm

raw
1 NAME SbVec2f SbV2f "" { 2D vector class }
2 INCLUDE SbLinear.h
3 DESC {
4 2D vector class used to store 2D vectors and points. This class is used
5 throughout Inventor for arguments and return values.
6 \-
7 This object does not have \mCreate\. or \mDelete\.
8 functions because it is considered a simple datatype; instances of
9 this class may be declared directly as local or global variables in C.
10 C programmers can access the components of the vector as though it were
11 a simple structure or use the access and operation functions described
12 in this reference page:
13 \b\k
14 struct SbVec2f \{ float vec[2]; \};
15
16 SbVec2f v1, v2;
17
18 /* The next two lines produce equivalent vectors. */
19 v1.vec[0] = 1.0; v1.vec[1] = 1.0;
20 SbV2fSetX_Y( v2, 1.0, 1.0 );
21 \.\.\.
22 }
23
24 BEGIN C++
25 METHOD "" SbVec2f() { Default constructor. }
26 METHOD "" SbVec2f(const float v[2]) {}
27 METHOD "" SbVec2f(float x, float y) {
28 Constructor given vector components.
29 }
30 METHOD "" float dot(const SbVec2f &v) const {
31 Returns dot (inner) product of vector and another vector.
32 }
33 END
34
35 BEGIN C
36 MACRO SbV2fDot(SbVec2f vec0, SbVec2f vec1) {
37 Returns dot (inner) product of two vectors.
38 }
39 END
40
41 METHOD "" SbBool equals(const SbVec2f v, float tolerance) const {
42 Equality comparison within given tolerance \(em the square of the
43 length of the maximum distance between the two vectors.
44 }
45
46 BEGIN C++
47 METHOD "" const float *getValue() const {}
48 METHOD "" void getValue(float &x, float &y) const {
49 Returns vector components.
50 }
51 END
52
53 BEGIN C
54 MACRO SbV2fGetXY(float array[2], SbVec2f vec) {}
55 MACRO SbV2fGetX_Y(float x, float y, SbVec2f vec) {
56 Returns vector components.
57 }
58 END
59
60 BEGIN C++
61 METHOD "" float length() const {
62 Returns geometric length of vector.
63 }
64 METHOD "" void negate() {
65 Negates each component of vector in place.
66 }
67 END
68 BEGIN C
69 MACRO SbV2fLen(SbVec2f vec) {
70 Returns geometric length of vector.
71 }
72 MACRO SbV2fNegate(SbVec2f vec) {
73 Negates each component of vector in place.
74 }
75 MACRO SbV2fSetXY(SbVec2f vec, float array[2]) {}
76 MACRO SbV2fSetX_Y(SbVec2f vec, float x, float y) {
77 Sets the vector components.
78 }
79 MACRO SbV2fMultBy(SbVec2f vec, float scalar) {}
80 MACRO SbV2fDivBy(SbVec2f vec, float scalar) {
81 Component-wise scalar multiplication and division operators.
82 }
83 MACRO SbV2fAdd(SbVec2f dest, SbVec2f src1, SbVec2f src2) {}
84 MACRO SbV2fSub(SbVec2f dest, SbVec2f src1, SbVec2f src2) {
85 Component-wise binary vector addition and subtraction operators.
86 }
87 END
88 METHOD norm float normalize() {
89 Changes vector to be unit length.
90 }
91 BEGIN C++
92 METHOD "" SbVec2f & setValue(const float v[2]) {}
93 METHOD "" SbVec2f & setValue(float x, float y) {
94 Sets the vector components.
95 }
96 METHOD "" float & operator [\|](int i) {}
97 METHOD "" const float & operator [\|](int i) {
98 Accesses indexed component of vector.
99 }
100 METHOD "" SbVec2f & operator *=(float d) {}
101 METHOD "" SbVec2f & operator /=(float d) {
102 Component-wise scalar multiplication and division operators.
103 }
104 METHOD "" SbVec2f & operator +=(const SbVec2f &u) {}
105 METHOD "" SbVec2f & operator -=(const SbVec2f &u) {
106 Component-wise vector addition and subtraction operators.
107 }
108 METHOD "" SbVec2f operator -() const {
109 Nondestructive unary negation \(em returns a new vector.
110 }
111 METHOD "" SbVec2f operator *(const SbVec2f &v, float d) {}
112 METHOD "" SbVec2f operator *(float d, const SbVec2f &v) {}
113 METHOD "" SbVec2f operator /(const SbVec2f &v, float d) {
114 Component-wise binary scalar multiplication and division operators.
115 }
116 METHOD "" SbVec2f operator +(const SbVec2f &v1, const SbVec2f &v2) {}
117 METHOD "" SbVec2f operator -(const SbVec2f &v1, const SbVec2f &v2) {
118 Component-wise binary vector addition and subtraction operators.
119 }
120 END
121 METHOD "" int operator ==(const SbVec2f &v1, const SbVec2f &v2) {}
122 METHOD "" int operator !=(const SbVec2f &v1, const SbVec2f &v2) {
123 Equality comparison operators.
124 }
125 ALSO { SbVec3f, SbVec4f, SbVec2s, SbRotation }