Jpp
16.0.0-rc.1
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JGeometry3D
JPolyline3D.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <fstream>
3
4
#include "
JGeometry3D/JPolyline3D.hh
"
5
using namespace
JGEOMETRY3D ;
6
using namespace
std ;
7
8
inline
void
printPolyline
(
const
JPolyline3D
& pl) {
9
for
(
int
i=0; i<(int)pl.size()-1; ++i) {
10
cout <<
"("
<< pl[i] <<
")-"
;
11
}
12
if
(pl.size() > 0) {
13
cout <<
"("
<< pl.back() <<
")"
;
14
}
15
}
16
17
/**
18
* \file
19
*
20
* Example program for the JGEOMETRY::JPolyline3D class.
21
* \author mjongen
22
*/
23
int
main
(
int
argc,
char
** argv ) {
24
// create a polyline with three vertices
25
JPolyline3D
pl(3) ;
26
27
// set vertex positions
28
pl[0] =
JGEOMETRY3D::JVector3D
(1,0,0) ;
29
pl[1] =
JGEOMETRY3D::JVector3D
(0,1,0) ;
30
pl[2] =
JGEOMETRY3D::JVector3D
(0,0,1) ;
31
32
// print vertex positions
33
cout <<
"Initial polyline: "
<< endl ;
34
printPolyline
(pl) ;
35
cout << endl ;
36
37
// create rotation around the z-axis
38
JRotation3Z
R
( 0.5*M_PI ) ;
39
40
// rotate
41
pl.
rotate
(R) ;
42
cout <<
"After a 90 degree rotation around the z-axis:"
<< endl ;
43
printPolyline
(pl) ;
44
cout << endl ;
45
46
// rotate back
47
pl.
rotate_back
(R) ;
48
cout <<
"After rotating back:"
<< endl ;
49
printPolyline
(pl) ;
50
cout << endl ;
51
52
cout << endl ;
53
cout <<
"Done!"
<< endl ;
54
55
return
0 ;
56
}
JPolyline3D.hh
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JGEOMETRY3D::JRotation3Z
Rotation around Z-axis.
Definition:
JRotation3D.hh:85
JGEOMETRY3D::JVector3D
Data structure for vector in three dimensions.
Definition:
JVector3D.hh:34
R
then usage $script[distance] fi case set_variable R
Definition:
JDrawLED.sh:43
JGEOMETRY3D::JPolyline3D::rotate
JPolyline3D & rotate(const JRotation3D &R)
Rotate all vertices.
Definition:
JPolyline3D.hh:72
JGEOMETRY3D::JPolyline3D
Data structure for polyline in three dimensions.
Definition:
JPolyline3D.hh:25
printPolyline
void printPolyline(const JPolyline3D &pl)
Definition:
JPolyline3D.cc:8
JGEOMETRY3D::JPolyline3D::rotate_back
JPolyline3D & rotate_back(const JRotation3D &R)
Rotate back all vertices.
Definition:
JPolyline3D.hh:83
Generated by
1.8.5