vrecko
virtual reality framework
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
RegularPolygonSpline.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "Spline.h"
4
#include "Utils.h"
5
#include <osg\BoundsChecking>
6
7
static
const
double
PI_SQUARED = 6.28318530717958647692;
8
9
class
RegularPolygonSpline
:
public
Spline
10
{
11
public
:
12
enum
PlaneType
13
{
14
XY
,
15
XZ
,
16
YZ
17
};
18
19
RegularPolygonSpline
();
20
RegularPolygonSpline
(
double
radius,
unsigned
int
segmentCount,
double
rotationShiftInDegress = 0.0,
PlaneType
plane =
XY
);
21
23
META_DAObject
(
RegularPolygonSpline
,
"Regular Polygon Spline"
)
24
25
virtual
Vec3ArrayPtr
getPoints();
26
virtual
bool
isClosed
() {
return
true
; }
27
29
double
getRadius
()
const
{
return
_radius
; }
30
inline
void
setRadius
(
double
val);
31
32
unsigned
int
getSegmentCount
()
const
{
return
_segmentCount
; }
33
inline
void
setSegmentCount
(
unsigned
int
val);
34
35
RegularPolygonSpline::PlaneType
getPlane
()
const
{
return
_plane
; }
36
inline
void
setPlane
(
RegularPolygonSpline::PlaneType
val);
37
38
double
getRotationShift
()
const
{
return
_rotationInDegress
; }
39
inline
void
setRotationShift
(
double
val);
40
41
protected
:
42
unsigned
int
_segmentCount
;
43
double
_invSegmentCount
;
44
double
_radius
;
45
PlaneType
_plane
;
46
double
_rotationInDegress
;
47
double
_shift
;
48
};
49
50
typedef
osg::ref_ptr<RegularPolygonSpline>
RegularPolygonSplinePtr
;
51
52
void
RegularPolygonSpline::setRadius
(
double
val )
53
{
54
_radius
= osg::clampAbove(val, 0.0);
55
_dirty =
true
;
56
}
57
58
void
RegularPolygonSpline::setSegmentCount
(
unsigned
int
val )
59
{
60
_segmentCount
= val;
61
osg::clampGEQUAL<unsigned int>(
_segmentCount
, 3,
"segmentCount"
);
62
_invSegmentCount
= PI_SQUARED /
_segmentCount
;
63
64
_dirty =
true
;
65
}
66
67
void
RegularPolygonSpline::setPlane
(
RegularPolygonSpline::PlaneType
val)
68
{
69
_plane
= val;
70
_dirty =
true
;
71
}
72
73
void
RegularPolygonSpline::setRotationShift
(
double
val)
74
{
75
_rotationInDegress
= val;
76
_shift
= osg::DegreesToRadians(
_rotationInDegress
);
77
_dirty =
true
;
78
}
src
vreckoAP
DynamicArt
RegularPolygonSpline.h
Generated on Tue Feb 19 2013 10:23:46 for vrecko by
1.8.3.1