Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
263272e3
Commit
263272e3
authored
Apr 20, 2020
by
Dennis Gläser
Browse files
[python][point] add repr field
parent
0eecec25
Changes
1
Hide whitespace changes
Inline
Side-by-side
frackit/python/geometry/point.hh
View file @
263272e3
...
...
@@ -106,10 +106,22 @@ namespace Detail {
// define retrieval functions for the coordinates
cls
.
def
(
"x"
,
&
Point
::
x
,
"x-coordinate of the point"
);
if
constexpr
(
worldDim
>
1
)
cls
.
def
(
"y"
,
&
Point
::
y
,
"y-coordinate of the point"
);
if
constexpr
(
worldDim
>
2
)
cls
.
def
(
"z"
,
&
Point
::
z
,
"z-coordinate of the point"
);
if
constexpr
(
worldDim
>
1
)
cls
.
def
(
"y"
,
&
Point
::
y
,
"y-coordinate of the point"
);
if
constexpr
(
worldDim
>
2
)
cls
.
def
(
"z"
,
&
Point
::
z
,
"z-coordinate of the point"
);
using
std
::
to_string
;
if
constexpr
(
worldDim
==
1
)
cls
.
def
(
"__repr__"
,
[
&
]
(
const
Point
&
p
)
{
return
"Frackit::Point<1> ("
+
to_string
(
p
.
x
())
+
")"
;
});
else
if
constexpr
(
worldDim
==
2
)
cls
.
def
(
"__repr__"
,
[
&
]
(
const
Point
&
p
)
{
return
"Frackit::Point<2> ("
+
to_string
(
p
.
x
())
+
", "
+
to_string
(
p
.
y
())
+
")"
;
});
else
cls
.
def
(
"__repr__"
,
[
&
]
(
const
Point
&
p
)
{
return
"Frackit::Point<3> ("
+
to_string
(
p
.
x
())
+
", "
+
to_string
(
p
.
y
())
+
", "
+
to_string
(
p
.
z
())
+
")"
;
});
}
}
// end namespace detail
...
...
Write
Preview
Supports
Markdown
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