basetypes.h File Reference

Basic types for representing data in VRML/X3D worlds (color, rotations, vectors, etc.). More...

#include <openvrml-common.h>
#include <cassert>
#include <cstddef>
#include <algorithm>
#include <iosfwd>
#include <vector>
#include <boost/cstdint.hpp>

Include dependency graph for basetypes.h:

This graph shows which files directly or indirectly include this file:


Classes

struct  openvrml::color
 A POD-struct comprising a color. More...
struct  openvrml::color_rgba
 A POD-struct comprising a color with an alpha channel. More...
struct  openvrml::vec2f
 A POD-struct comprising a two-component single-precision vector. More...
struct  openvrml::vec2d
 Two-component double-precision vector. More...
struct  openvrml::vec3f
 Three-component single-precision vector. More...
struct  openvrml::vec3d
 A POD-struct comprising a three-component double-precision vector. More...
struct  openvrml::rotation
 A POD-struct comprising a rotation. More...
struct  openvrml::mat4f
 A POD-struct comprising a 4x4 matrix. More...
struct  openvrml::quatf
 A POD-struct comprising a quaternion. More...
class  openvrml::image
 Pixmap data. More...

Namespaces

namespace  openvrml
 The OpenVRML Runtime Library.
namespace  std
 STL namespace.

Typedefs

typedef boost::int32_t openvrml::int32
 32-bit signed integer.

Functions

const color openvrml::make_color () throw ()
 Create a zero-initialized color.
const color openvrml::make_color (const float(&rgb)[3]) throw ()
 Create a color.
const color openvrml::make_color (float r, float g, float b) throw ()
 Create a color.
bool openvrml::operator== (const color &lhs, const color &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const color &lhs, const color &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, color &c)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const color &c)
 Stream output.
const color_rgba openvrml::make_color_rgba () throw ()
 Create a zero-initialized color_rgba.
const color_rgba openvrml::make_color_rgba (const float(&rgba)[4]) throw ()
 Create a color_rgba.
const color_rgba openvrml::make_color_rgba (float r, float g, float b, float a) throw ()
 Create a color_rgba.
bool openvrml::operator== (const color_rgba &lhs, const color_rgba &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const color_rgba &lhs, const color_rgba &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, color_rgba &c)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const color_rgba &c)
 Stream output.
const vec2f openvrml::make_vec2f () throw ()
 Create a vec2f.
const vec2f openvrml::make_vec2f (const float(&vec)[2]) throw ()
 Create a vec2f from an array.
const vec2f openvrml::make_vec2f (float x, float y) throw ()
 Create a vec2f from x and y components.
const vec2f openvrml::operator* (const vec2f &lhs, float rhs) throw ()
 Multiply a vector by a scalar.
const vec2f openvrml::operator* (float lhs, const vec2f &rhs) throw ()
 Multiply a vector by a scalar.
const vec2f openvrml::operator/ (const vec2f &lhs, float rhs) throw ()
 Divide a vector by a scalar.
const vec2f openvrml::operator+ (const vec2f &lhs, const vec2f &rhs) throw ()
 Add two vectors.
const vec2f openvrml::operator- (const vec2f &lhs, const vec2f &rhs) throw ()
 Subtract two vectors.
bool openvrml::operator== (const vec2f &lhs, const vec2f &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const vec2f &lhs, const vec2f &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, vec2f &v)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const vec2f &v)
 Stream output.
const vec2d openvrml::make_vec2d () throw ()
 Create a vec2d.
const vec2d openvrml::make_vec2d (const double(&vec)[2]) throw ()
 Create a vec2d from an array.
const vec2d openvrml::make_vec2d (double x, double y) throw ()
 Create a vec2d from x and y components.
const vec2d openvrml::operator* (const vec2d &lhs, double rhs) throw ()
 Multiply a vector by a scalar.
const vec2d openvrml::operator* (double lhs, const vec2d &rhs) throw ()
 Multiply a vector by a scalar.
const vec2d openvrml::operator/ (const vec2d &lhs, double rhs) throw ()
 Divide a vector by a scalar.
const vec2d openvrml::operator+ (const vec2d &lhs, const vec2d &rhs) throw ()
 Add two vectors.
const vec2d openvrml::operator- (const vec2d &lhs, const vec2d &rhs) throw ()
 Subtract two vectors.
bool openvrml::operator== (const vec2d &lhs, const vec2d &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const vec2d &lhs, const vec2d &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, vec2d &v)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const vec2d &v)
 Stream output.
const vec3f openvrml::make_vec3f () throw ()
 Create a vec3f.
const vec3f openvrml::make_vec3f (const float(&vec)[3]) throw ()
 Create a vec3f from an array.
const vec3f openvrml::make_vec3f (float x, float y, float z) throw ()
 Create a vec3f from x, y, and z components.
const vec3f openvrml::operator* (const vec3f &lhs, const vec3f &rhs) throw ()
 Cross multiply two vectors.
const vec3f openvrml::operator* (const vec3f &lhs, float rhs) throw ()
 Multiply a vector by a scalar.
const vec3f openvrml::operator* (float lhs, const vec3f &rhs) throw ()
 Multiply a vector by a scalar.
const vec3f openvrml::operator* (const vec3f &lhs, const mat4f &mat) throw ()
 Multiply a vector by a matrix.
const vec3f openvrml::operator* (const mat4f &mat, const vec3f &vec) throw ()
 Multiply a matrix by a vector.
const vec3f openvrml::operator/ (const vec3f &lhs, float rhs) throw ()
 Divide a vector by a scalar.
const vec3f openvrml::operator+ (const vec3f &lhs, const vec3f &rhs) throw ()
 Add two vectors.
const vec3f openvrml::operator- (const vec3f &lhs, const vec3f &rhs) throw ()
 Subtract two vectors.
bool openvrml::operator== (const vec3f &lhs, const vec3f &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const vec3f &lhs, const vec3f &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, vec3f &v)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const vec3f &v)
 Stream output.
const vec3d openvrml::make_vec3d () throw ()
 Create a vec3d.
const vec3d openvrml::make_vec3d (const double(&vec)[3]) throw ()
 Create a vec3d from an array.
const vec3d openvrml::make_vec3d (double x, double y, double z) throw ()
 Create a vec3d from x, y, and z components.
const vec3d openvrml::operator* (const vec3d &lhs, const vec3d &rhs) throw ()
 Cross multiply two vectors.
const vec3d openvrml::operator* (const vec3d &lhs, double rhs) throw ()
 Multiply a vector by a scalar.
const vec3d openvrml::operator* (double lhs, const vec3d &rhs) throw ()
 Multiply a vector by a scalar.
const vec3d openvrml::operator* (const vec3d &lhs, const mat4f &mat) throw ()
 Multiply a vector by a matrix.
const vec3d openvrml::operator* (const mat4f &mat, const vec3d &vec) throw ()
 Multiply a matrix by a vector.
const vec3d openvrml::operator/ (const vec3d &lhs, double rhs) throw ()
 Divide a vector by a scalar.
const vec3d openvrml::operator+ (const vec3d &lhs, const vec3d &rhs) throw ()
 Add two vectors.
const vec3d openvrml::operator- (const vec3d &lhs, const vec3d &rhs) throw ()
 Subtract two vectors.
bool openvrml::operator== (const vec3d &lhs, const vec3d &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const vec3d &lhs, const vec3d &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, vec3d &v)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const vec3d &v)
 Stream output.
const rotation openvrml::make_rotation () throw ()
 Create a default rotation.
const rotation openvrml::make_rotation (const float(&rot)[4]) throw ()
 Create a rotation from an array.
const rotation openvrml::make_rotation (float x, float y, float z, float angle) throw ()
 Create a rotation from x, y, z, and angle components.
const rotation openvrml::make_rotation (const vec3f &axis, float angle) throw ()
 Create a rotation from an axis vector and an angle.
const rotation openvrml::make_rotation (const vec3f &from_vec, const vec3f &to_vec) throw ()
 Create a rotation equal to the rotation between two different vectors.
const rotation openvrml::make_rotation (const quatf &quat) throw ()
 Create a rotation from a quaternion.
const rotation openvrml::operator* (const rotation &lhs, const rotation &rhs) throw ()
 Multiply rotations.
bool openvrml::operator== (const rotation &lhs, const rotation &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const rotation &lhs, const rotation &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, rotation &rot)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const rotation &r)
 Stream output.
const mat4f openvrml::make_mat4f () throw ()
 Create an identity matrix.
const mat4f openvrml::make_mat4f (float f11, float f12, float f13, float f14, float f21, float f22, float f23, float f24, float f31, float f32, float f33, float f34, float f41, float f42, float f43, float f44) throw ()
 Create a mat4f with given 16 elements in row-major order.
const mat4f openvrml::make_mat4f (const float mat[16]) throw ()
 Create a matrix from an array of 16 values.
const mat4f openvrml::make_mat4f (const float(&mat)[4][4]) throw ()
 Create a matrix from a 4x4 array.
const mat4f openvrml::make_rotation_mat4f (const rotation &rot) throw ()
 Create a rotation matrix.
const mat4f openvrml::make_rotation_mat4f (const quatf &quat) throw ()
 Create a rotation matrix.
const mat4f openvrml::make_scale_mat4f (float s) throw ()
 Create a uniform scale matrix.
const mat4f openvrml::make_scale_mat4f (const vec3f &s) throw ()
 Create a scale matrix.
const mat4f openvrml::make_translation_mat4f (const vec3f &t) throw ()
 Create a translation matrix.
const mat4f openvrml::make_transformation_mat4f (const vec3f &t, const rotation &r, const vec3f &s, const rotation &sr, const vec3f &c) throw ()
 Create a transformation matrix from a translation, a rotation, a scale, a scaleOrientation, and a center.
bool openvrml::operator== (const mat4f &lhs, const mat4f &rhs) throw ()
 Equality comparison operator.
bool openvrml::operator!= (const mat4f &lhs, const mat4f &rhs) throw ()
 Inequality comparison operator.
const mat4f openvrml::operator* (const mat4f &lhs, const mat4f &rhs) throw ()
 Multiply two matrices.
const mat4f openvrml::operator* (const mat4f &mat, float scalar) throw ()
 Multiply a matrix by a scalar value.
const mat4f openvrml::operator* (float scalar, const mat4f &mat) throw ()
 Multiply a scalar value by matrix.
std::istream & openvrml::operator>> (std::istream &in, mat4f &mat)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const mat4f &mat)
 Stream output.
const quatf openvrml::make_quatf () throw ()
 Create a default quatf.
const quatf openvrml::make_quatf (float x, float y, float z, float w) throw ()
 Create a quatf from four values.
const quatf openvrml::make_quatf (const float(&quat)[4]) throw ()
 Create a quatf from an array of four values.
const quatf openvrml::make_quatf (const rotation &rot) throw ()
 Create a quatf from a rotation.
const quatf openvrml::make_quatf (const mat4f &mat) throw ()
 Create a quatf from a rotation matrix.
const quatf openvrml::operator* (const quatf &lhs, const quatf &rhs) throw ()
 Multiply two quaternions.
const quatf openvrml::operator* (const quatf &quat, const float scalar) throw ()
 Multiply a quaternion by a scalar.
const quatf openvrml::operator* (const float scalar, const quatf &quat) throw ()
 Multiply a scalar by a quaternion.
const quatf openvrml::operator/ (const quatf &quat, const float scalar) throw ()
 Divide a quaternion by a scalar.
const quatf openvrml::operator+ (const quatf &lhs, const quatf &rhs) throw ()
 Add two quaternions.
const quatf openvrml::operator- (const quatf &lhs, const quatf &rhs) throw ()
 Take the difference between two quaternions.
bool openvrml::operator== (const quatf &lhs, const quatf &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const quatf &lhs, const quatf &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, quatf &q)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const quatf &quat)
 Stream output.
bool openvrml::operator== (const image &lhs, const image &rhs) throw ()
 Compare for equality.
bool openvrml::operator!= (const image &lhs, const image &rhs) throw ()
 Compare for inequality.
std::istream & openvrml::operator>> (std::istream &in, image &img)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const image &img)
 Stream output.
template<>
void std::swap (openvrml::image &a, openvrml::image &b)
 Swap the values of and b.

Detailed Description

Basic types for representing data in VRML/X3D worlds (color, rotations, vectors, etc.).