Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jigyasa Watwani
/
growth-pattern-control
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d9e3725c
authored
Jan 08, 2024
by
Jigyasa Watwani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in perimeter calculation
parent
07690244
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
convergence_extension/perimeter_long_axis.py
convergence_extension/perimeter_long_axis.py
View file @
d9e3725c
...
...
@@ -7,7 +7,11 @@ from scipy.spatial import ConvexHull
def
perimeter
(
X
,
Y
):
points
=
np
.
column_stack
((
X
,
Y
))
hull
=
ConvexHull
(
points
)
value
=
sum
(
np
.
linalg
.
norm
(
points
[
hull
.
vertices
[
i
]]
-
points
[
hull
.
vertices
[(
i
+
1
)
%
len
(
hull
.
vertices
)]])
for
i
in
range
(
len
(
hull
.
vertices
)))
N
=
len
(
hull
.
vertices
)
value
=
0
for
i
in
range
(
N
):
value
+=
np
.
linalg
.
norm
(
points
[
hull
.
vertices
[
i
]]
-
points
[
hull
.
vertices
[(
i
+
1
)
%
N
]])
# The (i+1)%N part ensures that after the last vertex, we go back to the first vertex, creating a closed loop
return
value
def
long_axis
(
x
,
y
):
...
...
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