Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hoek, Steven
lmgeo
Commits
c0948289
Commit
c0948289
authored
May 19, 2021
by
Hoek, Steven
Browse files
Handling of input in different forms enabled further
parent
5d485fd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
lmgeo/toolbox/vectorlib.py
View file @
c0948289
...
...
@@ -47,8 +47,12 @@ class Triangle(object):
assert
len
(
self
.
__points
)
==
3
,
"Triangle must have 3 corners!"
# Calculate the centroid by averaging coordinates
xc
=
[
pt
[
0
]
for
pt
in
self
.
__points
]
/
3
yc
=
[
pt
[
1
]
for
pt
in
self
.
__points
]
/
3
if
hasattr
(
self
.
__points
[
0
],
"__len__"
):
xc
=
sum
([
pt
[
0
]
for
pt
in
self
.
__points
])
/
3
yc
=
sum
([
pt
[
1
]
for
pt
in
self
.
__points
])
/
3
elif
hasattr
(
self
.
__points
[
0
],
"x"
)
and
hasattr
(
self
.
__points
[
0
],
"y"
):
xc
=
sum
([
pt
.
x
for
pt
in
self
.
__points
])
/
3
yc
=
sum
([
pt
.
y
for
pt
in
self
.
__points
])
/
3
return
xc
,
yc
# TODO: develop this class
...
...
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