-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat(polydatacellnormals): compute cell normals #2436
base: master
Are you sure you want to change the base?
Conversation
@@ -105,6 +153,13 @@ function vtkPolyDataNormals(publicAPI, model) { | |||
|
|||
output.getPointData().setNormals(outputNormals); | |||
|
|||
if (model.computeCellNormals) { | |||
const outputCellNormalsData = | |||
publicAPI.vtkPolyDataCellNormalsExecute(input); |
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.
it's too bad you are recomputing the normals that were computed when doing points normals.
Can you please modify vtkPolyDataNormalsExecute
to optionally return cells normals ?
CELL: 'cell', | ||
POINT: ' point', | ||
}; | ||
|
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.
does not seem used, is it ?
Can you please also update index.js.ts with the new set/get accessors ? |
numberOfPoints = polysData[c]; | ||
|
||
if (numberOfPoints < 3) { | ||
continue; // eslint-disable-line |
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.
indent pb
(v1[2] + v2[2] + v3[2]) / 3, | ||
]; | ||
|
||
const line = vtkLineSource.newInstance({ |
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.
how about an arrow source instead ?
(alternatively, you can consider vtkGlyphMapper3D)
(v1[0] + v2[0] + v3[0]) / 3, | ||
(v1[1] + v2[1] + v3[1]) / 3, | ||
(v1[2] + v2[2] + v3[2]) / 3, | ||
]; |
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.
Looks like a good candidate to be exposed publicly in vtkTriangle as a static function.
@emil-peters have you had a chance to look at the suggestions ? |
Context
closes #2434
Gives the option through
setComputeCellNormals
to compute the cell normals for polyData using thevtkPolyDataNormals
filter.Results
Changes
polyData.getCellData().getNormals().getData()
vtkPolyDataNormals
filter to compute the cell normals-> Question related to this: can you autogenerate TS-def files? Or should these be created manually?
PR and Code Checklist
npm run reformat
to have correctly formatted codeTODO
I was thinking it might make sense to either change the
publicAPI.vtkPolyDataNormalsExecute
to accept only one parameter, which would bevtkPolyData
.Or to merge
publicAPI.vtkPolyDataNormalsExecute
andpublicAPI.vtkPolyDataCellNormalsExecute
into one method, as there is quite some duplication in both?I don't know what would be preferred.
Update the example to switch between cell and vertex normals