Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
cpp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edu
cpp
Commits
65ec711c
Commit
65ec711c
authored
Dec 17, 2020
by
Hans Buchmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getter x() and y()
parent
62d60730
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
6-cia/src/geo2d-vz.cc
6-cia/src/geo2d-vz.cc
+9
-10
No files found.
6-cia/src/geo2d-vz.cc
View file @
65ec711c
...
...
@@ -74,9 +74,10 @@ class Point
double
distance
(
const
Point
&
other
)
const
;
//| |--- my own variables cannot be changed
//other cannot be changed
static
double
distance
(
Point
p
,
Point
q
);
// private: Suende
//getter
double
x
()
const
;
double
y
()
const
;
private:
void
svg
();
//draw the point
double
xc
;
//x-coordinate
double
yc
;
//y-coordinate
...
...
@@ -123,11 +124,6 @@ void Point::svg()
SVG
::
dot
(
xc
,
yc
);
//with default radius
}
double
Point
::
distance
(
Point
p
,
Point
q
)
//is not a member of Point
{
return
std
::
hypot
(
q
.
xc
-
p
.
xc
,
q
.
yc
-
p
.
yc
);
// |private
}
double
Point
::
distance
(
const
Point
&
other
)
const
//is a member of Point
// |----------c++ reference
...
...
@@ -144,6 +140,9 @@ double Point::distance(const Point& other) const //is a member of Point
yc
-
other
.
yc
);
}
inline
double
Point
::
x
()
const
{
return
xc
;}
inline
double
Point
::
y
()
const
{
return
yc
;}
//----------------------------------------------- Line
// implementation
Line
::
Line
(
const
Point
&
p
,
const
Point
&
q
)
...
...
@@ -159,8 +158,8 @@ Line::~Line()
void
Line
::
svg
()
{
SVG
::
line
(
pp
.
x
c
,
pp
.
yc
,
//x0,y0
qq
.
x
c
,
qq
.
yc
);
//x1 y1
SVG
::
line
(
pp
.
x
(),
pp
.
y
(),
//x0,y0
qq
.
x
(),
qq
.
y
()
);
//x1 y1
}
int
main
(
int
argc
,
char
**
args
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment