test(particles.cloudPoint): add tests for intersectsMesh function #12992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
I add some tests to Particles/cloudPoint, the function is intersectsMesh.
Here I found some points.
mesh
has incorrect type. In fact this property may haveundefined
as value, because it's not defined in the constructor. So I add optional mark?
to type and required checks in the class.intersectsMesh
function did not check the mesh property existing in the point cloud system. So I add a new Error here, that notice about required mesh to next calculations.isSphere = isSphere ? isSphere : false;
look like redundant, because TypeScript promise that it have boolean type.const bbox = target.getBoundingInfo().boundingBox;
. It's look for me as potential performance boost, maybe.else
branch because it rendundant because the code above have return statements.And I limited test cases from 729 possible combinations to 126, they seems like corner cases for me. I dont know which cases we can reduce to save the working guarantee.