basetypes.h File Reference


Detailed Description

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

#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:


Namespaces

namespace  openvrml
namespace  std

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...

Typedefs

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

Functions

const openvrml::color openvrml::make_color () throw ()
 Create a zero-initialized color.
const openvrml::color openvrml::make_color (const float(&rgb)[3]) throw ()
 Create a color.
const openvrml::color openvrml::make_color (const float r, const float g, const 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 openvrml::color_rgba openvrml::make_color_rgba () throw ()
 Create a zero-initialized color_rgba.
const openvrml::color_rgba openvrml::make_color_rgba (const float(&rgba)[4]) throw ()
 Create a color_rgba.
const openvrml::color_rgba openvrml::make_color_rgba (const float r, const float g, const float b, const 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 openvrml::vec2f openvrml::make_vec2f () throw ()
 Create a vec2f.
const openvrml::vec2f openvrml::make_vec2f (const float(&vec)[2]) throw ()
 Create a vec2f from an array.
const openvrml::vec2f openvrml::make_vec2f (const float x, const float y) throw ()
 Create a vec2f from x and y components.
const openvrml::vec2f openvrml::operator * (const vec2f &lhs, const float rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec2f openvrml::operator * (const float lhs, const vec2f &rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec2f openvrml::operator/ (const vec2f &lhs, const float rhs) throw ()
 Divide a vector by a scalar.
const openvrml::vec2f openvrml::operator+ (const vec2f &lhs, const vec2f &rhs) throw ()
 Add two vectors.
const openvrml::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 openvrml::vec2d openvrml::make_vec2d () throw ()
 Create a vec2d.
const openvrml::vec2d openvrml::make_vec2d (const double(&vec)[2]) throw ()
 Create a vec2d from an array.
const openvrml::vec2d openvrml::make_vec2d (const double x, const double y) throw ()
 Create a vec2d from x and y components.
const openvrml::vec2d openvrml::operator * (const vec2d &lhs, const double rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec2d openvrml::operator * (const double lhs, const vec2d &rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec2d openvrml::operator/ (const vec2d &lhs, const double rhs) throw ()
 Divide a vector by a scalar.
const openvrml::vec2d openvrml::operator+ (const vec2d &lhs, const vec2d &rhs) throw ()
 Add two vectors.
const openvrml::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 openvrml::vec3f openvrml::make_vec3f () throw ()
 Create a vec3f.
const openvrml::vec3f openvrml::make_vec3f (const float(&vec)[3]) throw ()
 Create a vec3f from an array.
const openvrml::vec3f openvrml::make_vec3f (const float x, const float y, const float z) throw ()
 Create a vec3f from x, y, and z components.
const openvrml::vec3f openvrml::operator * (const vec3f &lhs, const vec3f &rhs) throw ()
 Cross multiply two vectors.
const openvrml::vec3f openvrml::operator * (const vec3f &lhs, const float rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec3f openvrml::operator * (const float lhs, const vec3f &rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec3f openvrml::operator * (const vec3f &vec, const mat4f &mat) throw ()
 Multiply a vector by a matrix.
const openvrml::vec3f openvrml::operator * (const mat4f &mat, const vec3f &vec) throw ()
 Multiply a matrix by a vector.
const openvrml::vec3f openvrml::operator/ (const vec3f &lhs, const float rhs) throw ()
 Divide a vector by a scalar.
const openvrml::vec3f openvrml::operator+ (const vec3f &lhs, const vec3f &rhs) throw ()
 Add two vectors.
const openvrml::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 openvrml::vec3d openvrml::make_vec3d () throw ()
 Create a vec3d.
const openvrml::vec3d openvrml::make_vec3d (const double(&vec)[3]) throw ()
 Create a vec3d from an array.
const openvrml::vec3d openvrml::make_vec3d (const double x, const double y, const double z) throw ()
 Create a vec3d from x, y, and z components.
const openvrml::vec3d openvrml::operator * (const vec3d &lhs, const vec3d &rhs) throw ()
 Cross multiply two vectors.
const openvrml::vec3d openvrml::operator * (const vec3d &lhs, const double rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec3d openvrml::operator * (const double lhs, const vec3d &rhs) throw ()
 Multiply a vector by a scalar.
const openvrml::vec3d openvrml::operator * (const vec3d &vec, const mat4f &mat) throw ()
 Multiply a vector by a matrix.
const openvrml::vec3d openvrml::operator * (const mat4f &mat, const vec3d &vec) throw ()
 Multiply a matrix by a vector.
const openvrml::vec3d openvrml::operator/ (const vec3d &lhs, const double rhs) throw ()
 Divide a vector by a scalar.
const openvrml::vec3d openvrml::operator+ (const vec3d &lhs, const vec3d &rhs) throw ()
 Add two vectors.
const openvrml::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 openvrml::rotation openvrml::make_rotation () throw ()
 Create a default rotation.
const openvrml::rotation openvrml::make_rotation (const float(&rot)[4]) throw ()
 Create a rotation from an array.
const openvrml::rotation openvrml::make_rotation (const float x, const float y, const float z, const float angle) throw ()
 Create a rotation from x, y, z, and angle components.
const openvrml::rotation openvrml::make_rotation (const vec3f &axis, const float angle) throw ()
 Create a rotation from an axis vector and an angle.
const openvrml::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 openvrml::rotation openvrml::make_rotation (const quatf &quat) throw ()
 Create a rotation from a quaternion.
const openvrml::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 openvrml::mat4f openvrml::make_mat4f () throw ()
 Create an identity matrix.
const openvrml::mat4f openvrml::make_mat4f (const float f11, const float f12, const float f13, const float f14, const float f21, const float f22, const float f23, const float f24, const float f31, const float f32, const float f33, const float f34, const float f41, const float f42, const float f43, const float f44) throw ()
 Create a mat4f with given 16 elements in row-major order.
const openvrml::mat4f openvrml::make_mat4f (const float mat[16]) throw ()
 Create a matrix from an array of 16 values.
const openvrml::mat4f openvrml::make_mat4f (const float(&mat)[4][4]) throw ()
 Create a matrix from a 4x4 array.
const openvrml::mat4f openvrml::make_rotation_mat4f (const rotation &rot) throw ()
 Create a rotation matrix.
const openvrml::mat4f openvrml::make_rotation_mat4f (const quatf &quat) throw ()
 Create a rotation matrix.
const openvrml::mat4f openvrml::make_scale_mat4f (const float s) throw ()
 Create a uniform scale matrix.
const openvrml::mat4f openvrml::make_scale_mat4f (const vec3f &s) throw ()
 Create a scale matrix.
const openvrml::mat4f openvrml::make_translation_mat4f (const vec3f &t) throw ()
 Create a translation matrix.
const openvrml::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 openvrml::mat4f openvrml::operator * (const mat4f &lhs, const mat4f &rhs) throw ()
 Multiply two matrices.
const openvrml::mat4f openvrml::operator * (const mat4f &mat, const float scalar) throw ()
 Multiply a matrix by a scalar value.
const openvrml::mat4f openvrml::operator * (const float scalar, const mat4f &mat) throw ()
 Multiply a scalar value by matrix.
std::istream & openvrml::operator>> (std::istream &in, mat4f &m)
 Stream input.
std::ostream & openvrml::operator<< (std::ostream &out, const mat4f &mat)
 Stream output.
const openvrml::quatf openvrml::make_quatf () throw ()
 Create a default quatf.
const openvrml::quatf openvrml::make_quatf (const float x, const float y, const float z, const float w) throw ()
 Create a quatf from four values.
const openvrml::quatf openvrml::make_quatf (const float(&quat)[4]) throw ()
 Create a quatf from an array of four values.
const openvrml::quatf openvrml::make_quatf (const rotation &rot) throw ()
 Create a quatf from a rotation.
const openvrml::quatf openvrml::make_quatf (const mat4f &mat) throw ()
 Create a quatf from a rotation matrix.
const openvrml::quatf openvrml::operator * (const quatf &lhs, const quatf &rhs) throw ()
 Multiply two quaternions.
const openvrml::quatf openvrml::operator * (const quatf &quat, const float scalar) throw ()
 Multiply a quaternion by a scalar.
const openvrml::quatf openvrml::operator * (const float scalar, const quatf &quat) throw ()
 Multiply a scalar by a quaternion.
const openvrml::quatf openvrml::operator/ (const quatf &quat, const float scalar) throw ()
 Divide a quaternion by a scalar.
const openvrml::quatf openvrml::operator+ (const quatf &lhs, const quatf &rhs) throw ()
 Add two quaternions.
const openvrml::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.