TORCS
1.3.9
The Open Racing Car Simulator
Cone.cpp
Go to the documentation of this file.
1
/*
2
SOLID - Software Library for Interference Detection
3
Copyright (C) 1997-1998 Gino van den Bergen
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
9
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
14
15
You should have received a copy of the GNU Library General Public
16
License along with this library; if not, write to the Free
17
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19
Please send remarks, questions and bug reports to gino@win.tue.nl,
20
or write to:
21
Gino van den Bergen
22
Department of Mathematics and Computing Science
23
Eindhoven University of Technology
24
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
25
*/
26
27
#ifdef _MSC_VER
28
#pragma warning(disable:4786) // identifier was truncated to '255'
29
#endif // _MSC_VER
30
31
#include "
Cone.h
"
32
33
Point
Cone::support
(
const
Vector
& v)
const
{
34
if
(v[
Y
] > v.
length
() *
sinAngle
)
return
Point
(0,
halfHeight
, 0);
35
else
{
36
Scalar
s = sqrt(v[
X
] * v[
X
] + v[
Z
] * v[
Z
]);
37
if
(s >
EPSILON
) {
38
Scalar
d =
bottomRadius
/ s;
39
return
Point
(v[
X
] * d, -
halfHeight
, v[
Z
] * d);
40
}
41
else
return
Point
(0, -
halfHeight
, 0);
42
}
43
}
44
Vector::length
Scalar length() const
Definition:
Vector.h:126
X
Definition:
Basic.h:58
Cone::support
Point support(const Vector &) const
Definition:
Cone.cpp:33
Z
Definition:
Basic.h:58
Cone::sinAngle
Scalar sinAngle
Definition:
Cone.h:48
Cone::halfHeight
Scalar halfHeight
Definition:
Cone.h:47
Cone.h
Y
Definition:
Basic.h:58
Scalar
#define Scalar
Definition:
Basic.h:34
Vector
Definition:
Vector.h:32
Cone::bottomRadius
Scalar bottomRadius
Definition:
Cone.h:46
EPSILON
const Scalar EPSILON
Definition:
Basic.h:39
Point
Definition:
Point.h:34
src
modules
simu
simuv2
SOLID-2.0
src
Cone.cpp
Generated by
1.8.14