A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
fast-clipping.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INESC Porto
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Gustavo Carneiro <gjc@inescporto.pt>
7
*/
8
9
namespace
ns3
10
{
11
12
namespace
visualizer
13
{
14
/**
15
* @ingroup Visualizer
16
*
17
* This class is used by the visualizer for the process of removing lines or portions of
18
* lines outside of an area of interest.
19
*
20
* This code has been adapted from
21
* http://en.wikipedia.org/w/index.php?title=Line_clipping&oldid=248609574
22
*
23
**/
24
class
FastClipping
25
{
26
public
:
27
/**
28
* @ingroup Visualizer
29
*
30
* The Vector 2 struct
31
*/
32
struct
Vector2
33
{
34
double
x
;
//!< X coordinate.
35
double
y
;
//!< Y coordinate.
36
};
37
38
/**
39
* @ingroup Visualizer
40
*
41
* The line struct
42
*/
43
struct
Line
44
{
45
Vector2
start
;
//!< The start point of the line.
46
Vector2
end
;
//!< The end point of the line.
47
double
dx
;
//!< dX
48
double
dy
;
//!< dY
49
};
50
51
/**
52
* Constructor
53
*
54
* @param clipMin minimum clipping vector
55
* @param clipMax maximum clipping vector
56
*/
57
FastClipping
(
Vector2
clipMin,
Vector2
clipMax);
58
59
/**
60
* Clip line function
61
*
62
* @param line the clip line
63
* @returns true if clipped
64
*/
65
bool
ClipLine
(
Line
& line);
66
67
private
:
68
/**
69
* Clip start top function
70
*
71
* @param line the clip line
72
*/
73
void
ClipStartTop
(
Line
& line)
const
;
74
75
/**
76
* Clip start bottom function
77
*
78
* @param line the clip line
79
*/
80
void
ClipStartBottom
(
Line
& line)
const
;
81
82
/**
83
* Clip start right function
84
*
85
* @param line the clip line
86
*/
87
void
ClipStartRight
(
Line
& line)
const
;
88
89
/**
90
* Clip start left function
91
*
92
* @param line the clip line
93
*/
94
void
ClipStartLeft
(
Line
& line)
const
;
95
96
/**
97
* Clip end top function
98
*
99
* @param line the clip line
100
*/
101
void
ClipEndTop
(
Line
& line)
const
;
102
103
/**
104
* Clip end bottom function
105
*
106
* @param line the clip line
107
*/
108
void
ClipEndBottom
(
Line
& line)
const
;
109
110
/**
111
* Clip end right function
112
*
113
* @param line the clip line
114
*/
115
void
ClipEndRight
(
Line
& line)
const
;
116
117
/**
118
* Clip end left function
119
*
120
* @param line the clip line
121
*/
122
void
ClipEndLeft
(
Line
& line)
const
;
123
124
Vector2
m_clipMin
;
//!< The minimum point of the bounding area required clipping.
125
Vector2
m_clipMax
;
//!< The maximum point of the bounding area required clipping.
126
};
127
128
}
// namespace visualizer
129
}
// namespace ns3
ns3::visualizer::FastClipping::ClipEndRight
void ClipEndRight(Line &line) const
Clip end right function.
Definition
fast-clipping.cc:65
ns3::visualizer::FastClipping::ClipLine
bool ClipLine(Line &line)
Clip line function.
Definition
fast-clipping.cc:79
ns3::visualizer::FastClipping::m_clipMin
Vector2 m_clipMin
The minimum point of the bounding area required clipping.
Definition
fast-clipping.h:124
ns3::visualizer::FastClipping::ClipStartRight
void ClipStartRight(Line &line) const
Clip start right function.
Definition
fast-clipping.cc:37
ns3::visualizer::FastClipping::ClipEndTop
void ClipEndTop(Line &line) const
Clip end top function.
Definition
fast-clipping.cc:51
ns3::visualizer::FastClipping::ClipStartBottom
void ClipStartBottom(Line &line) const
Clip start bottom function.
Definition
fast-clipping.cc:30
ns3::visualizer::FastClipping::m_clipMax
Vector2 m_clipMax
The maximum point of the bounding area required clipping.
Definition
fast-clipping.h:125
ns3::visualizer::FastClipping::ClipStartTop
void ClipStartTop(Line &line) const
Clip start top function.
Definition
fast-clipping.cc:23
ns3::visualizer::FastClipping::FastClipping
FastClipping(Vector2 clipMin, Vector2 clipMax)
Constructor.
Definition
fast-clipping.cc:16
ns3::visualizer::FastClipping::ClipStartLeft
void ClipStartLeft(Line &line) const
Clip start left function.
Definition
fast-clipping.cc:44
ns3::visualizer::FastClipping::ClipEndLeft
void ClipEndLeft(Line &line) const
Clip end left function.
Definition
fast-clipping.cc:72
ns3::visualizer::FastClipping::ClipEndBottom
void ClipEndBottom(Line &line) const
Clip end bottom function.
Definition
fast-clipping.cc:58
ns3::visualizer
Definition
fast-clipping.cc:14
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::visualizer::FastClipping::Line
The line struct.
Definition
fast-clipping.h:44
ns3::visualizer::FastClipping::Line::dx
double dx
dX
Definition
fast-clipping.h:47
ns3::visualizer::FastClipping::Line::start
Vector2 start
The start point of the line.
Definition
fast-clipping.h:45
ns3::visualizer::FastClipping::Line::dy
double dy
dY
Definition
fast-clipping.h:48
ns3::visualizer::FastClipping::Line::end
Vector2 end
The end point of the line.
Definition
fast-clipping.h:46
ns3::visualizer::FastClipping::Vector2
The Vector 2 struct.
Definition
fast-clipping.h:33
ns3::visualizer::FastClipping::Vector2::y
double y
Y coordinate.
Definition
fast-clipping.h:35
ns3::visualizer::FastClipping::Vector2::x
double x
X coordinate.
Definition
fast-clipping.h:34
src
visualizer
model
fast-clipping.h
Generated on
for ns-3 by
1.15.0