Utils-three-js new three js utils which help to build application with three js

I have created npm package which help up to build web application with three js.

I have also created tables for APIs documentation.

Please check and let me know your suggestion

Thanks for sharing your project.

Do yo plan to add more complex functions? Some of the implemented ones are rather low-level and just add some checks. Some observations:

  • there is a tendency in the code to use a lot the length of BufferAttribute arrays, in some case it is preferable to use count instead of length.
  • it appears indexed and non-indexed geometries are not equally supported
  • sometimes there are too many redundant checks, for example: getFacePointIndices checks whether geometry is BufferGeometry, then it calls getNumberOfFaces that checks again whether the same geometry is BufferGeometry, … and getNumberOfFaces calls getPositionArray which checks yet again that the very same geometry is still BufferGeometry.
1 Like

I don’t find this useful. There is no reason why these shouldn’t be just static methods. I don’t understand why throw an error when accessing a field that can legitimately be null. Like why throw why not warn “geometry not indexed”?

Thanks for you review.

Yes I will add more complex functions in future whenever I will get time.

I will review my code according to your suggestions.

for comment related to low-level checks,
I have created module for my projects, so I can easily manage those functions,
and I prefer method instead of accessing property directly using “.”
That is reason behind some low-level check functions like “isBufferGeometry”

Again, thanks for your suggestion

1 Like

Thanks for your review.
Not an issue if you don’t find useful for you.
May be someone find this helpful or may be no one can find this helpful.

I used static methods, because I thought anyone can use specific functions without creating object.
If they have buffergeometry, they directly passed to static method and use it according to need.

For errors, I want user get errors so, they can validate data passed in functions.
But sure, I will check and replace some of the errors with warnings

Thats great! Thanks.