186
Appendix A: Cosmo Basic Types
The classes also provide the following write and operator methods:
void write(csOutput *out);
csVec4f& operator=(const csVec4f &v);
csVec4f& operator=(float v);
float& operator[](int i);
float operator[](int i) const;
csBool operator==(const csVec4f &v) const;
csBool operator!=(const csVec4f &v) const;
The write() method prints the vector to the device or file defined by out.
The operator() method defines an operation that can be performed on two vectors. The
first two operator methods are assignment operators, the second two are access
operators, and the last two are equality operators. For example,
csVec2f *myVec = new csVec2f();
csVec2f *yourVec = new csVec2f();
...
if (myVec == yourVec) {...}
csVec3s
The methods in csVec3s are the same as those in the csVec3f class.
csVec4ub Methods
The csVec4ub class contains a subset of the above methods, including the set(), get(),
equal(), write(), and operator() methods for two-, three-, and four-dimensional ubyte
quantities. For example, the four-dimensional definition is
csVec4ub(ubyte a, ubyte b, ubyte c, ubyte d);
Transforming csVec3f Vectors
csVec3f vectors are commonly used to specify the placement and orientation of objects
in world space. There are two ways to transform a csVec3f when passing a csMatrix4f
into xform():