Aufgrund einer Wartung wird GitLab am 17.08. zwischen 8:30 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 17.08. between 8:30 and 9:00 am.

Commit a29ff880 authored by Svetlana Pavlitskaya's avatar Svetlana Pavlitskaya

Repository clean-up

parent 574d3635
*.idea*
*cmake-build-*
*.a
*.o
*.so
*.depend
/torcs/config.log
/torcs/config.status
/torcs/Make-config
torcs/*-bin
torcs/*.spec
torcs/export/
torcs/.torcs.rc
torcs/Make-config
torcs/config.log
torcs/config.status
torcs/autom4te.cache/
torcs/src/doc/torcsdoc.conf
torcs/src/linux/torcs
torcs/src/tools/accc/accc
torcs/src/tools/nfs2ac/nfs2ac
torcs/src/tools/nfsperf/nfsperf
torcs/src/tools/texmapper/texmapper
torcs/src/tools/trackgen/trackgen
torcs/src/libs/txml/gennmtab/gennmtab
torcs/src/linux/torcs-bin
torcs/src/tools/accc/accc-bin
torcs/src/tools/nfs2ac/nfs2ac-bin
torcs/src/tools/nfsperf/nfsperf-bin
torcs/src/tools/package/specfiles/torcs-data-cars-Patwo-Design.spec
torcs/src/tools/package/specfiles/torcs-data-cars-extra.spec
torcs/src/tools/package/specfiles/torcs-data-cars-kcendra-gt.spec
torcs/src/tools/package/specfiles/torcs-data-cars-kcendra-roadsters.spec
torcs/src/tools/package/specfiles/torcs-data-cars-kcendra-sport.spec
torcs/src/tools/package/specfiles/torcs-data-tracks-base.spec
torcs/src/tools/package/specfiles/torcs-data.spec
torcs/src/tools/package/specfiles/torcs-robot-K1999.spec
torcs/src/tools/package/specfiles/torcs-robot-base.spec
torcs/src/tools/package/specfiles/torcs.spec
torcs/src/tools/texmapper/texmapper-bin
torcs/src/tools/trackgen/trackgen-bin
TORCS_BASE = /home/alex/MA_sveta/DeepDrivingCode_v2/DeepDriving/torcs-1.3.6
MAKE_DEFAULT = /home/alex/MA_sveta/DeepDrivingCode_v2/DeepDriving/torcs-1.3.6/Make-default.mk
# Make-config. Generated from Make-config.in by configure.
##############################################################################
#
# file : Make-config.in
# created : Mon Dec 11 23:47:37 CET 2000
# copyright : (C) 2000 by Eric Espi�
# email : Eric.Espie@torcs.org
# version : $Id: Make-config.in,v 1.17.2.1 2008/06/01 20:19:38 berniw Exp $
#
##############################################################################
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
##############################################################################
SHELL = /bin/bash
srcdir = .
top_srcdir = ${TORCS_BASE}
prefix = /home/alex/MA_sveta/code-torcs/binary
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib/torcs
datarootdir = ${prefix}/share
datadir = ${prefix}/share/games/torcs
vardir = ${prefix}/var/games/torcs
top_builddir = .
CC = /usr/bin/gcc
CXX = /usr/bin/g++
LD = ld
AR = ar
ARFLAGS = ruv
RANLIB = ranlib
INSTALL = /usr/bin/install -c
#INSTALL_PROGRAM = /usr/bin/install -c -m 755
#INSTALL_DATA = /usr/bin/install -c -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SCRIPT = ${INSTALL}
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CFLAGSD = -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DHAVE_CONFIG_H
CXXFLAGS = -g3 -gdwarf-2 -Wall -fPIC -fno-strict-aliasing -O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES -Wall -fPIC -fno-strict-aliasing -O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES ${CFLAGSD}
CFLAGS = -g3 -gdwarf-2 -Wall -fPIC -fno-strict-aliasing -O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES -Wall -fPIC -fno-strict-aliasing -O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES ${CFLAGSD}
#EXT_LIBS = -lpthread -lplibjs -lplibssgaux -lplibssg -lplibsm -lplibsl -lplibsg -lplibul -lglut -lGLU -lGL -lpng -lz -ldl -lXrandr -lXrender -lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11 -lm
EXT_LIBS = -lplibjs -lplibssgaux -lplibssg -lplibsm -lplibsl -lplibsg -lplibul -lglut -lGLU -lGL -lpng -lz -ldl -lXrandr -lXrender -lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11 -lm
#LDFLAGS = -lopenal -lalut -lvorbisfile -L${EXPORTBASE}/lib -L/usr/lib -L/usr/local/lib
LDFLAGS = -L${EXPORTBASE}/lib -lopenal -lalut -lvorbisfile -L/usr/lib
#INCFLAGS = -I${EXPORTBASE}/include -I/usr/include -I/usr/local/include
INCFLAGS = -I${EXPORTBASE}/include -I${TORCS_BASE}
CPP = /usr/bin/gcc -E -M -D__DEPEND__
PACKAGE = torcs
VERSION = 1.3.6
TAR = gtar
GZIP_ENV = --best
This diff is collapsed.
This diff is collapsed.
/Makefile/1.2/Mon May 29 23:47:13 2006//Tr1-3-1
D/dirt-1////
D/dirt-2////
D/dirt-3////
:ext:berniw@torcs.cvs.sourceforge.net:/cvsroot/torcs
/*
3D - C++ Class Library for 3D Transformations
Copyright (C) 1996-1998 Gino van den Bergen
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Please send remarks, questions and bug reports to gino@win.tue.nl,
or write to:
Gino van den Bergen
Department of Mathematics and Computing Science
Eindhoven University of Technology
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
*/
#ifndef _BASIC_H_
#define _BASIC_H_
#include <math.h>
#include <stdlib.h>
/* typedef double Scalar; */
#define Scalar double
const Scalar DEGS_PER_RAD = 57.29577951308232286465;
const Scalar RADS_PER_DEG = 0.01745329251994329547;
const Scalar TWO_PI = 6.28318530717958623200;
const Scalar EPSILON = 1.0e-10;
const Scalar EPSILON2 = 1.0e-20;
const Scalar INFINITY_ = 1.0e50;
/* inline Scalar abs(Scalar x) { return x < 0 ? -x : x; } */
inline Scalar rnd() { return (Scalar(rand()) + 0.5) / (Scalar(RAND_MAX) + 1); }
inline int sgn(Scalar x) { return x < 0 ? -1 : x > 0 ? 1 : 0; }
inline bool eqz(Scalar x) { return fabs(x) <= EPSILON; }
inline Scalar min(Scalar x, Scalar y) { return x > y ? y : x; }
inline Scalar max(Scalar x, Scalar y) { return x < y ? y : x; }
inline void set_min(Scalar& x, Scalar y) { if (x > y) x = y; }
inline void set_max(Scalar& x, Scalar y) { if (x < y) x = y; }
inline Scalar rads(Scalar x) { return x * RADS_PER_DEG; }
inline Scalar degs(Scalar x) { return x * DEGS_PER_RAD; }
enum { X = 0, Y = 1, Z = 2, W = 3 };
#endif
/*
3D - C++ Class Library for 3D Transformations
Copyright (C) 1996-1998 Gino van den Bergen
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Please send remarks, questions and bug reports to gino@win.tue.nl,
or write to:
Gino van den Bergen
Department of Mathematics and Computing Science
Eindhoven University of Technology
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
*/
#ifndef _MATRIX_H_
#define _MATRIX_H_
#include "Vector.h"
#include "Quaternion.h"
typedef Scalar Mat3[3][3];
// Row-major 3x3 matrix
class Matrix {
public:
Matrix() {}
Matrix(const float *m) { setValue(m); }
Matrix(const double *m) { setValue(m); }
Matrix(const Quaternion& q) { setRotation(q); }
Matrix(Scalar x, Scalar y, Scalar z) { setScaling(x, y, z); }
Matrix(Scalar xx, Scalar xy, Scalar xz,
Scalar yx, Scalar yy, Scalar yz,
Scalar zx, Scalar zy, Scalar zz) {
setValue(xx, xy, xz, yx, yy, yz, zx, zy, zz);
}
Vector& operator[](int i) { return *(Vector *)elem[i]; }
const Vector& operator[](int i) const { return *(Vector *)elem[i]; }
Mat3& getValue() { return elem; }
const Mat3& getValue() const { return elem; }
void setValue(const float *m) {
elem[X][X] = *m++; elem[Y][X] = *m++; elem[Z][X] = *m++; m++;
elem[X][Y] = *m++; elem[Y][Y] = *m++; elem[Z][Y] = *m++; m++;
elem[X][Z] = *m++; elem[Y][Z] = *m++; elem[Z][Z] = *m;
}
void setValue(const double *m) {
elem[X][X] = *m++; elem[Y][X] = *m++; elem[Z][X] = *m++; m++;
elem[X][Y] = *m++; elem[Y][Y] = *m++; elem[Z][Y] = *m++; m++;
elem[X][Z] = *m++; elem[Y][Z] = *m++; elem[Z][Z] = *m;
}
void setValue(Scalar xx, Scalar xy, Scalar xz,
Scalar yx, Scalar yy, Scalar yz,
Scalar zx, Scalar zy, Scalar zz) {
elem[X][X] = xx; elem[X][Y] = xy; elem[X][Z] = xz;
elem[Y][X] = yx; elem[Y][Y] = yy; elem[Y][Z] = yz;
elem[Z][X] = zx; elem[Z][Y] = zy; elem[Z][Z] = zz;
}
void setRotation(const Quaternion& q) {
Scalar d = q.length2();
assert(!eqz(d));
Scalar s = 2 / d;
Scalar xs = q[X] * s, ys = q[Y] * s, zs = q[Z] * s;
Scalar wx = q[W] * xs, wy = q[W] * ys, wz = q[W] * zs;
Scalar xx = q[X] * xs, xy = q[X] * ys, xz = q[X] * zs;
Scalar yy = q[Y] * ys, yz = q[Y] * zs, zz = q[Z] * zs;
setValue(1 - (yy + zz), xy - wz, xz + wy,
xy + wz , 1 - (xx + zz), yz - wx,
xz - wy , yz + wx , 1 - (xx + yy));
}
void setScaling(Scalar x, Scalar y, Scalar z) {
setValue(x, 0, 0, 0, y, 0, 0, 0, z);
}
void setIdentity() { setValue(1, 0, 0, 0, 1, 0, 0, 0, 1); }
Matrix& operator*=(const Matrix& m);
Scalar tdot(int i, const Vector& v) const {
return elem[X][i] * v[X] + elem[Y][i] * v[Y] + elem[Z][i] * v[Z];
}
Scalar determinant() const;
Matrix absolute() const;
Matrix transpose() const;
Matrix adjoint() const;
Matrix inverse() const;
protected:
Mat3 elem;
};
Vector operator*(const Matrix& m, const Vector& v);
Vector operator*(const Vector& v, const Matrix& m);
Matrix operator*(const Matrix& m1, const Matrix& m2);
Matrix multTransposeLeft(const Matrix& m1, const Matrix& m2);
Matrix transpose(const Matrix& m);
Matrix adjoint(const Matrix& m);
Matrix inverse(const Matrix& m);
Matrix absolute(const Matrix& m);
ostream& operator<<(ostream& os, const Matrix& m);
inline Matrix& Matrix::operator*=(const Matrix& m) {
setValue(elem[X][X] * m[X][X] + elem[X][Y] * m[Y][X] + elem[X][Z] * m[Z][X],
elem[X][X] * m[X][Y] + elem[X][Y] * m[Y][Y] + elem[X][Z] * m[Z][Y],
elem[X][X] * m[X][Z] + elem[X][Y] * m[Y][Z] + elem[X][Z] * m[Z][Z],
elem[Y][X] * m[X][X] + elem[Y][Y] * m[Y][X] + elem[Y][Z] * m[Z][X],
elem[Y][X] * m[X][Y] + elem[Y][Y] * m[Y][Y] + elem[Y][Z] * m[Z][Y],
elem[Y][X] * m[X][Z] + elem[Y][Y] * m[Y][Z] + elem[Y][Z] * m[Z][Z],
elem[Z][X] * m[X][X] + elem[Z][Y] * m[Y][X] + elem[Z][Z] * m[Z][X],
elem[Z][X] * m[X][Y] + elem[Z][Y] * m[Y][Y] + elem[Z][Z] * m[Z][Y],
elem[Z][X] * m[X][Z] + elem[Z][Y] * m[Y][Z] + elem[Z][Z] * m[Z][Z]);
return *this;
}
inline Scalar Matrix::determinant() const {
return triple((*this)[X], (*this)[Y], (*this)[Z]);
}
inline Matrix Matrix::absolute() const {
return Matrix(fabs(elem[X][X]), fabs(elem[X][Y]), fabs(elem[X][Z]),
fabs(elem[Y][X]), fabs(elem[Y][Y]), fabs(elem[Y][Z]),
fabs(elem[Z][X]), fabs(elem[Z][Y]), fabs(elem[Z][Z]));
}
inline Matrix Matrix::transpose() const {
return Matrix(elem[X][X], elem[Y][X], elem[Z][X],
elem[X][Y], elem[Y][Y], elem[Z][Y],
elem[X][Z], elem[Y][Z], elem[Z][Z]);
}
inline Matrix Matrix::adjoint() const {
return Matrix(elem[Y][Y] * elem[Z][Z] - elem[Y][Z] * elem[Z][Y],
elem[X][Z] * elem[Z][Y] - elem[X][Y] * elem[Z][Z],
elem[X][Y] * elem[Y][Z] - elem[X][Z] * elem[Y][Y],
elem[Y][Z] * elem[Z][X] - elem[Y][X] * elem[Z][Z],
elem[X][X] * elem[Z][Z] - elem[X][Z] * elem[Z][X],
elem[X][Z] * elem[Y][X] - elem[X][X] * elem[Y][Z],
elem[Y][X] * elem[Z][Y] - elem[Y][Y] * elem[Z][X],
elem[X][Y] * elem[Z][X] - elem[X][X] * elem[Z][Y],
elem[X][X] * elem[Y][Y] - elem[X][Y] * elem[Y][X]);
}
inline Matrix Matrix::inverse() const {
Vector co(elem[Y][Y] * elem[Z][Z] - elem[Y][Z] * elem[Z][Y],
elem[Y][Z] * elem[Z][X] - elem[Y][X] * elem[Z][Z],
elem[Y][X] * elem[Z][Y] - elem[Y][Y] * elem[Z][X]);
Scalar d = dot((*this)[X], co);
assert(!eqz(d));
Scalar s = 1 / d;
return Matrix(co[X] * s,
(elem[X][Z] * elem[Z][Y] - elem[X][Y] * elem[Z][Z]) * s,
(elem[X][Y] * elem[Y][Z] - elem[X][Z] * elem[Y][Y]) * s,
co[Y] * s,
(elem[X][X] * elem[Z][Z] - elem[X][Z] * elem[Z][X]) * s,
(elem[X][Z] * elem[Y][X] - elem[X][X] * elem[Y][Z]) * s,
co[Z] * s,
(elem[X][Y] * elem[Z][X] - elem[X][X] * elem[Z][Y]) * s,
(elem[X][X] * elem[Y][Y] - elem[X][Y] * elem[Y][X]) * s);
}
inline Vector operator*(const Matrix& m, const Vector& v) {
return Vector(dot(m[X], v), dot(m[Y], v), dot(m[Z], v));
}
inline Vector operator*(const Vector& v, const Matrix& m) {
return Vector(m.tdot(X, v), m.tdot(Y, v), m.tdot(Z, v));
}
inline Matrix operator*(const Matrix& m1, const Matrix& m2) {
return Matrix(
m1[X][X] * m2[X][X] + m1[X][Y] * m2[Y][X] + m1[X][Z] * m2[Z][X],
m1[X][X] * m2[X][Y] + m1[X][Y] * m2[Y][Y] + m1[X][Z] * m2[Z][Y],
m1[X][X] * m2[X][Z] + m1[X][Y] * m2[Y][Z] + m1[X][Z] * m2[Z][Z],
m1[Y][X] * m2[X][X] + m1[Y][Y] * m2[Y][X] + m1[Y][Z] * m2[Z][X],
m1[Y][X] * m2[X][Y] + m1[Y][Y] * m2[Y][Y] + m1[Y][Z] * m2[Z][Y],
m1[Y][X] * m2[X][Z] + m1[Y][Y] * m2[Y][Z] + m1[Y][Z] * m2[Z][Z],
m1[Z][X] * m2[X][X] + m1[Z][Y] * m2[Y][X] + m1[Z][Z] * m2[Z][X],
m1[Z][X] * m2[X][Y] + m1[Z][Y] * m2[Y][Y] + m1[Z][Z] * m2[Z][Y],
m1[Z][X] * m2[X][Z] + m1[Z][Y] * m2[Y][Z] + m1[Z][Z] * m2[Z][Z]);
}
inline Matrix multTransposeLeft(const Matrix& m1, const Matrix& m2) {
return Matrix(
m1[X][X] * m2[X][X] + m1[Y][X] * m2[Y][X] + m1[Z][X] * m2[Z][X],
m1[X][X] * m2[X][Y] + m1[Y][X] * m2[Y][Y] + m1[Z][X] * m2[Z][Y],
m1[X][X] * m2[X][Z] + m1[Y][X] * m2[Y][Z] + m1[Z][X] * m2[Z][Z],
m1[X][Y] * m2[X][X] + m1[Y][Y] * m2[Y][X] + m1[Z][Y] * m2[Z][X],
m1[X][Y] * m2[X][Y] + m1[Y][Y] * m2[Y][Y] + m1[Z][Y] * m2[Z][Y],
m1[X][Y] * m2[X][Z] + m1[Y][Y] * m2[Y][Z] + m1[Z][Y] * m2[Z][Z],
m1[X][Z] * m2[X][X] + m1[Y][Z] * m2[Y][X] + m1[Z][Z] * m2[Z][X],
m1[X][Z] * m2[X][Y] + m1[Y][Z] * m2[Y][Y] + m1[Z][Z] * m2[Z][Y],
m1[X][Z] * m2[X][Z] + m1[Y][Z] * m2[Y][Z] + m1[Z][Z] * m2[Z][Z]);
}
inline Scalar determinant(const Matrix& m) { return m.determinant(); }
inline Matrix absolute(const Matrix& m) { return m.absolute(); }
inline Matrix transpose(const Matrix& m) { return m.transpose(); }
inline Matrix adjoint(const Matrix& m) { return m.adjoint(); }
inline Matrix inverse(const Matrix& m) { return m.inverse(); }
inline ostream& operator<<(ostream& os, const Matrix& m) {
return os << m[X] << endl << m[Y] << endl << m[Z] << endl;
}
#endif
/*
3D - C++ Class Library for 3D Transformations
Copyright (C) 1996-1998 Gino van den Bergen
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Please send remarks, questions and bug reports to gino@win.tue.nl,
or write to:
Gino van den Bergen
Department of Mathematics and Computing Science
Eindhoven University of Technology
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
*/
#ifndef _POINT_H_
#define _POINT_H_
#include <algorithm>
#include "Vector.h"
class Point : public Vector {
public:
Point() {}
Point(const float p[3]) : Vector(p) {}
Point(const double p[3]) : Vector(p) {}
Point(Scalar x, Scalar y, Scalar z) : Vector(x, y, z) {}
Point& operator+=(const Vector& v);
Point& operator-=(const Vector& v);
Point& operator=(const Vector& v);
void setInf(const Point& p);
void setSup(const Point& p);
};
Point operator+(const Point& p, const Vector& v);
Point operator-(const Point& p, const Vector& v);
Vector operator-(const Point& p1, const Point& p2);
bool operator<(const Point& p1, const Point& p2);
Point inf(const Point& p1, const Point& p2);
Point sup(const Point& p1, const Point& p2);
Point affine(const Point& p1, const Point& p2, Scalar t);
Scalar distance(const Point& p1, const Point& p2);
Scalar distance2(const Point& p1, const Point& p2);
inline Point& Point::operator+=(const Vector& v) {
comp[X] += v[X]; comp[Y] += v[Y]; comp[Z] += v[Z];
return *this;
}
inline Point& Point::operator-=(const Vector& v) {
comp[X] -= v[X]; comp[Y] -= v[Y]; comp[Z] -= v[Z];
return *this;
}
inline Point& Point::operator=(const Vector& v) {
comp[X] = v[X]; comp[Y] = v[Y]; comp[Z] = v[Z];
return *this;
}
inline void Point::setInf(const Point& p) {
set_min(comp[X], p[X]); set_min(comp[Y], p[Y]); set_min(comp[Z], p[Z]);
}
inline void Point::setSup(const Point& p) {
set_max(comp[X], p[X]); set_max(comp[Y], p[Y]); set_max(comp[Z], p[Z]);
}
inline Point operator+(const Point& p, const Vector& v) {
return Point(p[X] + v[X], p[Y] + v[Y], p[Z] + v[Z]);
}
inline Point operator-(const Point& p, const Vector& v) {
return Point(p[X] - v[X], p[Y] - v[Y], p[Z] - v[Z]);
}
inline Vector operator-(const Point& p1, const Point& p2) {
return Vector(p1[X] - p2[X], p1[Y] - p2[Y], p1[Z] - p2[Z]);
}
inline bool operator<(const Point& p1, const Point& p2) {
return p1[X] < p2[X] && p1[Y] < p2[Y] && p1[Z] < p2[Z];
}
inline Point inf(const Point& p1, const Point& p2) {
return Point(min(p1[X], p2[X]), min(p1[Y], p2[Y]), min(p1[Z], p2[Z]));
}
inline Point sup(const Point& p1, const Point& p2) {
return Point(max(p1[X], p2[X]), max(p1[Y], p2[Y]), max(p1[Z], p2[Z]));
}
inline Point affine(const Point& p1, const Point& p2, Scalar t) {
return Point(p1[X] + (p2[X] - p1[X]) * t,
p1[Y] + (p2[Y] - p1[Y]) * t,
p1[Z] + (p2[Z] - p1[Z]) * t);
}
inline Scalar distance(const Point& p1, const Point& p2) {
return length(p1 - p2);
}
inline Scalar distance2(const Point& p1, const Point& p2) {
return length2(p1 - p2);
}
#endif
/*
3D - C++ Class Library for 3D Transformations
Copyright (C) 1996-1998 Gino van den Bergen
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Please send remarks, questions and bug reports to gino@win.tue.nl,
or write to:
Gino van den Bergen
Department of Mathematics and Computing Science
Eindhoven University of Technology
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
*/
#ifndef _QUATERNION_H_
#define _QUATERNION_H_
#include "Tuple4.h"
#include "Vector.h"
class Quaternion : public Tuple4 {
public:
Quaternion() {}
Quaternion(const float v[4]) : Tuple4(v) {}
Quaternion(const double v[4]) : Tuple4(v) {}
Quaternion(Scalar x, Scalar y, Scalar z, Scalar w) : Tuple4(x, y, z, w) {}
Quaternion(const Vector& axis, Scalar angle) { setRotation(axis, angle); }
Quaternion(Scalar yaw, Scalar pitch, Scalar roll) {
setEuler(yaw, pitch, roll);
}
void setRotation(const Vector& axis, Scalar angle) {
Scalar d = axis.length();
assert(!eqz(d));
Scalar s = sin(angle / 2) / d;
setValue(axis[X] * s, axis[Y] * s, axis[Z] * s, cos(angle / 2));
}
void setEuler(Scalar yaw, Scalar pitch, Scalar roll) {
Scalar cosYaw = cos(yaw / 2);
Scalar sinYaw = sin(yaw / 2);
Scalar cosPitch = cos(pitch / 2);
Scalar sinPitch = sin(pitch / 2);
Scalar cosRoll = cos(roll / 2);
Scalar sinRoll = sin(roll / 2);
setValue(cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw,
cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw,
sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw,
cosRoll * cosPitch * cosYaw + sinRoll * sinPitch * sinYaw);