-
-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add polygon functions #2547
base: master
Are you sure you want to change the base?
Add polygon functions #2547
Conversation
b9ec532
to
2f8adf9
Compare
@luciemac @finetjul @DavidBerger98 The |
d1bff5e
to
a436863
Compare
28c5dea
to
7b85be5
Compare
e4ca963
to
578e9d4
Compare
578e9d4
to
2ddcf2f
Compare
Translation from cpp implementation and add test to those functions Create functions as static functions and in publicAPI Fix pointInPolygon and triangulate to return the triangles Updated ts definition
2ddcf2f
to
4584c83
Compare
WORK IN PROGRESS
model.points.getPoint(idsToHandle[i], current); | ||
const next = [0, 0, 0]; | ||
model.points.getPoint( | ||
toCorrectId(idsToHandle[toCorrectId(i + 1, idsToHandle.length)], numPts), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getPoint(
nextPoint(i, idsToHandle, numPts),
next
);
...
getPoint(
previousPoint(i, idsToHandle, numPts),
previous
);
firstPoint: null, | ||
pointCount: 0, | ||
tris: [], | ||
points: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model.points is actually defined in vtkCell as vtkPoints. I doubt it should be [] here
publicAPI.setPoints = (points, pointsIds) => { | ||
let pointsData = points; | ||
if (Array.isArray(pointsData[0])) { | ||
pointsData = points.flat(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be points.flat()
instead?
} else { | ||
model.pointsIds = pointsIds; | ||
} | ||
publicAPI.computeNormal(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably call modified()
} | ||
|
||
publicAPI.computeNormal = () => getNormal(model.points, model.normal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you ignore model.pointIds
, are you sure it is intended ?
Context
Translation of C++ functions of vtkPolygon.
Note: this PR is to be merged after PR #2532 as it uses functions implemented in the latter.
Results
Implementation of
Each of them are also exported as static functions.
Changes
The
computeNormal
function has been replaced by the static functiongetNormal
exported in the publicAPI ascomputeNormal
.PR and Code Checklist
npm run reformat
to have correctly formatted codeTesting