7 for(int i
= 0; i
< 3; ++i
)
13 Vec3f::Vec3f(float x
, float y
, float z
)
24 Vec3f::Vec3f(const Vec3f
& o
)
26 for(int i
= 0; i
< 3; ++i
)
28 m_values
[i
] = o
.m_values
[i
];
33 Vec3f::operator=(const Vec3f
& o
)
37 for(int i
= 0; i
< 3; ++i
)
39 m_values
[i
] = o
.m_values
[i
];
46 Vec3f::operator|(const Vec3f
& o
) const
52 Vec3f::dot(const Vec3f
& o
) const
55 for(int i
= 0; i
< 3; ++i
)
57 dot
+= m_values
[i
]*o
.m_values
[i
];
63 Vec3f::operator%(const Vec3f
& o
) const
65 return this->cross(o
);
69 Vec3f::cross(const Vec3f
& o
) const
71 float x
= m_values
[1]*o
.m_values
[2] - m_values
[2]*o
.m_values
[1];
72 float y
= m_values
[2]*o
.m_values
[0] - m_values
[0]*o
.m_values
[2];
73 float z
= m_values
[0]*o
.m_values
[1] - m_values
[1]*o
.m_values
[0];
81 float norm
= this->norm();
88 float n
= this->dot(*this);
93 Vec3f::operator*(const float t
) const
100 Vec3f::operator*=(const float t
)
102 for(int i
= 0; i
< 3; ++i
)
110 Vec3f::operator/(const float t
) const
117 Vec3f::operator/=(const float t
)
119 for(int i
= 0; i
< 3; ++i
)
126 // example implementation of a standard operator
128 Vec3f::operator+(const Vec3f
& o
) const
135 // example implementation of an in-place operator
137 Vec3f::operator+=(const Vec3f
& o
)
139 for(unsigned int i
= 0; i
< 3; ++i
)
141 m_values
[i
] += o
.m_values
[i
];
148 Vec3f::operator-(const Vec3f
& o
) const
156 Vec3f::operator-=(const Vec3f
& o
)
158 for(unsigned int i
= 0; i
< 3; ++i
)
160 m_values
[i
] -= o
.m_values
[i
];
166 Vec3f::operator*(const Vec3f
& o
) const
174 Vec3f::operator*=(const Vec3f
& o
)
176 for(unsigned int i
= 0; i
< 3; ++i
)
178 m_values
[i
] *= o
.m_values
[i
];
184 Vec3f::operator/(const Vec3f
& o
) const
192 Vec3f::operator/=(const Vec3f
& o
)
194 for(unsigned int i
= 0; i
< 3; ++i
)
196 m_values
[i
] /= o
.m_values
[i
];
202 Vec3f::operator[](unsigned int i
) const
209 Vec3f::operator[](unsigned int i
)
218 for(unsigned int i
= 0; i
< 3; ++i
)
220 if(m_values
[i
] < 0.0)
222 if(m_values
[i
] > 1.0)
This page took 0.052438 seconds and 5 git commands to generate.