QCAD Application Framework
CAD Application Development and Automation.
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RTriangle.h
Go to the documentation of this file.
1
#ifndef RTRIANGLE_H
2
#define RTRIANGLE_H
3
4
#include "
RShape.h
"
5
#include "
RVector.h
"
6
#include "
RLine.h
"
7
8
class
RBox
;
9
18
class
RTriangle
:
public
RShape
{
19
public
:
20
RTriangle
();
21
RTriangle
(
const
RVector
& p1,
const
RVector
& p2,
const
RVector
& p3);
22
virtual
~RTriangle
();
23
24
virtual
RTriangle
*
clone
()
const
{
25
return
new
RTriangle
(*
this
);
26
}
27
28
virtual
void
to2D
();
29
30
static
RTriangle
createArrow
(
const
RVector
& position,
double
direction,
double
size);
31
32
virtual
RBox
getBoundingBox
()
const
;
33
virtual
double
getLength
()
const
;
34
RVector
getCorner
(
int
i)
const
;
35
void
setCorner
(
int
i,
const
RVector
& p);
36
37
virtual
QList<RVector>
getEndPoints
()
const
;
38
virtual
QList<RVector>
getMiddlePoints
()
const
;
39
virtual
QList<RVector>
getCenterPoints
()
const
;
40
virtual
QList<RVector>
getPointsWithDistanceToEnd
(
41
double
distance,
RS::From
from =
RS::FromAny
)
const
;
42
43
double
getDistanceTo
(
const
RVector
& point,
bool
limited =
true
)
const
;
44
virtual
RVector
getVectorTo
(
const
RVector
& point,
bool
limited =
true
)
const
;
45
//virtual RVector getVectorTo(const RLine& line, bool limited = true) const;
46
47
virtual
RVector
getNormal
()
const
;
48
49
// virtual bool intersectsWith(const RShape& other, bool limited) const;
50
51
// virtual QList<RVector> getIntersectionPoints(const RShape& other,
52
// bool limited) const;
53
54
bool
isPointInTriangle
(
const
RVector
& p,
bool
treatAsQuadrant =
false
)
const
;
55
bool
isPointInQuadrant
(
const
RVector
& p)
const
;
56
57
double
getD
()
const
;
58
59
virtual
bool
move
(
const
RVector
& offset) {
60
corner
[0].
move
(offset);
61
corner
[1].
move
(offset);
62
corner
[2].
move
(offset);
63
return
true
;
64
}
65
virtual
bool
rotate
(
double
rotation,
const
RVector
& center =
RDEFAULT_RVECTOR
) {
66
corner
[0].
rotate
(rotation, center);
67
corner
[1].
rotate
(rotation, center);
68
corner
[2].
rotate
(rotation, center);
69
return
true
;
70
}
71
virtual
bool
scale
(
const
RVector
& scaleFactors,
const
RVector
& center =
72
RVector
()) {
73
corner
[0].
scale
(scaleFactors, center);
74
corner
[1].
scale
(scaleFactors, center);
75
corner
[2].
scale
(scaleFactors, center);
76
return
true
;
77
}
78
virtual
bool
mirror
(
const
RLine
& axis) {
79
corner
[0].
mirror
(axis);
80
corner
[1].
mirror
(axis);
81
corner
[2].
mirror
(axis);
82
return
true
;
83
}
84
virtual
bool
flipHorizontal
() {
85
corner
[0].
flipHorizontal
();
86
corner
[1].
flipHorizontal
();
87
corner
[2].
flipHorizontal
();
88
return
true
;
89
}
90
virtual
bool
flipVertical
() {
91
corner
[0].
flipVertical
();
92
corner
[1].
flipVertical
();
93
corner
[2].
flipVertical
();
94
return
true
;
95
}
96
97
public
:
98
RVector
corner
[3];
99
};
100
101
Q_DECLARE_METATYPE
(QList<RTriangle>)
102
Q_DECLARE_METATYPE
(
RTriangle
*)
103
Q_DECLARE_METATYPE
(const
RTriangle
*)
104
Q_DECLARE_METATYPE
(
RTriangle
)
105
Q_DECLARE_METATYPE
(QSharedPointer<
RTriangle
>)
106
Q_DECLARE_METATYPE
(QSharedPointer<
RTriangle
>*)
107
108
#endif
src
math
RTriangle.h
Generated on Tue Jun 26 2012 18:41:08 for QCAD Application Framework by
1.8.1.1