Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
AmpScan
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Joshua Steer
AmpScan
Commits
25fa90e3
Commit
25fa90e3
authored
6 years ago
by
ojs1g14
Browse files
Options
Downloads
Patches
Plain Diff
Update trim.py
parent
9aa00b51
No related branches found
No related tags found
No related merge requests found
Pipeline
#344
passed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AmpScan/trim.py
+22
-19
22 additions, 19 deletions
AmpScan/trim.py
with
22 additions
and
19 deletions
AmpScan/trim.py
+
22
−
19
View file @
25fa90e3
...
...
@@ -30,22 +30,25 @@ class trimMixin(object):
>>>
amp
.
planarTrim
(
100
,
2
)
"""
# planar values for each vert on face
fv
=
self
.
vert
[
self
.
faces
,
plane
]
# Number points on each face are above cut plane
fvlogic
=
(
fv
>
height
).
sum
(
axis
=
1
)
# Faces with points both above and below cut plane
adjf
=
self
.
faces
[
np
.
logical_or
(
fvlogic
==
2
,
fvlogic
==
1
)]
# Get adjacent vertices
adjv
=
np
.
unique
(
adjf
)
# Get vert above height and set to height
abvInd
=
adjv
[
self
.
vert
[
adjv
,
plane
]
>
height
]
self
.
vert
[
abvInd
,
plane
]
=
height
# Find all verts above plane
delv
=
self
.
vert
[:,
plane
]
>
height
# Reorder verts to account for deleted one
vInd
=
np
.
cumsum
(
~
delv
)
-
1
self
.
faces
=
self
.
faces
[
fvlogic
!=
3
,
:]
self
.
faces
=
vInd
[
self
.
faces
]
self
.
vert
=
self
.
vert
[
~
delv
,
:]
self
.
calcStruct
()
\ No newline at end of file
if
isinstance
(
height
,
float
)
and
isinstance
(
plane
,
int
):
# planar values for each vert on face
fv
=
self
.
vert
[
self
.
faces
,
plane
]
# Number points on each face are above cut plane
fvlogic
=
(
fv
>
height
).
sum
(
axis
=
1
)
# Faces with points both above and below cut plane
adjf
=
self
.
faces
[
np
.
logical_or
(
fvlogic
==
2
,
fvlogic
==
1
)]
# Get adjacent vertices
adjv
=
np
.
unique
(
adjf
)
# Get vert above height and set to height
abvInd
=
adjv
[
self
.
vert
[
adjv
,
plane
]
>
height
]
self
.
vert
[
abvInd
,
plane
]
=
height
# Find all verts above plane
delv
=
self
.
vert
[:,
plane
]
>
height
# Reorder verts to account for deleted one
vInd
=
np
.
cumsum
(
~
delv
)
-
1
self
.
faces
=
self
.
faces
[
fvlogic
!=
3
,
:]
self
.
faces
=
vInd
[
self
.
faces
]
self
.
vert
=
self
.
vert
[
~
delv
,
:]
self
.
calcStruct
()
else
:
raise
TypeError
(
"
height arg must be a float and plane arg must be an int
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment