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
fastClipping.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
/**
13
* @ingroup visualizer
14
*
15
* This class is used by the visualizer for the process of removing lines or portions of
16
* lines outside of an area of interest.
17
*
18
* This code has been adapted from
19
* http://en.wikipedia.org/w/index.php?title=Line_clipping&oldid=248609574
20
*
21
**/
22
class
FastClipping
23
{
24
public
:
25
/**
26
* @ingroup visualizer
27
*
28
* The Vector 2 struct
29
*/
30
struct
Vector2
31
{
32
double
x
;
//!< X coordinate.
33
double
y
;
//!< Y coordinate.
34
};
35
36
/**
37
* @ingroup visualizer
38
*
39
* The line struct
40
*/
41
struct
Line
42
{
43
Vector2
start
;
//!< The start point of the line.
44
Vector2
end
;
//!< The end point of the line.
45
double
dx
;
//!< dX
46
double
dy
;
//!< dY
47
};
48
49
/**
50
* Constructor
51
*
52
* @param clipMin minimum clipping vector
53
* @param clipMax maximum clipping vector
54
*/
55
FastClipping
(
Vector2
clipMin,
Vector2
clipMax);
56
57
/**
58
* Clip line function
59
*
60
* @param line the clip line
61
* @returns true if clipped
62
*/
63
bool
ClipLine
(
Line
& line);
64
65
private
:
66
/**
67
* Clip start top function
68
*
69
* @param line the clip line
70
*/
71
void
ClipStartTop
(
Line
& line)
const
;
72
73
/**
74
* Clip start bottom function
75
*
76
* @param line the clip line
77
*/
78
void
ClipStartBottom
(
Line
& line)
const
;
79
80
/**
81
* Clip start right function
82
*
83
* @param line the clip line
84
*/
85
void
ClipStartRight
(
Line
& line)
const
;
86
87
/**
88
* Clip start left function
89
*
90
* @param line the clip line
91
*/
92
void
ClipStartLeft
(
Line
& line)
const
;
93
94
/**
95
* Clip end top function
96
*
97
* @param line the clip line
98
*/
99
void
ClipEndTop
(
Line
& line)
const
;
100
101
/**
102
* Clip end bottom function
103
*
104
* @param line the clip line
105
*/
106
void
ClipEndBottom
(
Line
& line)
const
;
107
108
/**
109
* Clip end right function
110
*
111
* @param line the clip line
112
*/
113
void
ClipEndRight
(
Line
& line)
const
;
114
115
/**
116
* Clip end left function
117
*
118
* @param line the clip line
119
*/
120
void
ClipEndLeft
(
Line
& line)
const
;
121
122
Vector2
m_clipMin
;
//!< The minimum point of the bounding area required clipping.
123
Vector2
m_clipMax
;
//!< The maximum point of the bounding area required clipping.
124
};
125
}
// namespace ns3
ns3::FastClipping::ClipEndTop
void ClipEndTop(Line &line) const
Clip end top function.
Definition
fastClipping.cc:49
ns3::FastClipping::ClipEndBottom
void ClipEndBottom(Line &line) const
Clip end bottom function.
Definition
fastClipping.cc:56
ns3::FastClipping::m_clipMin
Vector2 m_clipMin
The minimum point of the bounding area required clipping.
Definition
fastClipping.h:122
ns3::FastClipping::ClipStartLeft
void ClipStartLeft(Line &line) const
Clip start left function.
Definition
fastClipping.cc:42
ns3::FastClipping::ClipStartTop
void ClipStartTop(Line &line) const
Clip start top function.
Definition
fastClipping.cc:21
ns3::FastClipping::ClipEndLeft
void ClipEndLeft(Line &line) const
Clip end left function.
Definition
fastClipping.cc:70
ns3::FastClipping::ClipStartBottom
void ClipStartBottom(Line &line) const
Clip start bottom function.
Definition
fastClipping.cc:28
ns3::FastClipping::ClipStartRight
void ClipStartRight(Line &line) const
Clip start right function.
Definition
fastClipping.cc:35
ns3::FastClipping::FastClipping
FastClipping(Vector2 clipMin, Vector2 clipMax)
Constructor.
Definition
fastClipping.cc:14
ns3::FastClipping::m_clipMax
Vector2 m_clipMax
The maximum point of the bounding area required clipping.
Definition
fastClipping.h:123
ns3::FastClipping::ClipLine
bool ClipLine(Line &line)
Clip line function.
Definition
fastClipping.cc:77
ns3::FastClipping::ClipEndRight
void ClipEndRight(Line &line) const
Clip end right function.
Definition
fastClipping.cc:63
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::FastClipping::Line
The line struct.
Definition
fastClipping.h:42
ns3::FastClipping::Line::start
Vector2 start
The start point of the line.
Definition
fastClipping.h:43
ns3::FastClipping::Line::dx
double dx
dX
Definition
fastClipping.h:45
ns3::FastClipping::Line::end
Vector2 end
The end point of the line.
Definition
fastClipping.h:44
ns3::FastClipping::Line::dy
double dy
dY
Definition
fastClipping.h:46
ns3::FastClipping::Vector2
The Vector 2 struct.
Definition
fastClipping.h:31
ns3::FastClipping::Vector2::x
double x
X coordinate.
Definition
fastClipping.h:32
ns3::FastClipping::Vector2::y
double y
Y coordinate.
Definition
fastClipping.h:33
src
visualizer
model
fastClipping.h
Generated on
for ns-3 by
1.15.0