Allow ExtrudeShapeXXX to patch up degenerate paths

This grew out of my adventures with creating an extrusion with radii based on a spline curve. When doing that I created an extrusion path that a) followed a straight path, but b) backed down the path, then reversed and went back up the path. In the process, it creates tangents, normals and binormals that are at points undefined or flipped from the previous one. When that happens, the extruded shape contour can be flipped, appear rotated, or collapsed into a single line. I propose and demonstrate an option to ExtrudeShapeXXX that can fix this by patching up the frame of tangent, normal and binormal vectors. In the playground below I show the problem and the fix. (The version of ExtrudeShapeCustom there is just a working version)

This version has a cleaner ExtrudeShapeGeneric function if someone wants to incorporate the fix - I’m still both Git and babylon build and test impaired.

Do you want to pair program with us to do your PR ??? maybe we could guide you in this area if you need anything ?

I can try; it’s just another hill I was trying to skirt. My programming world was embedded systems: everything web is foreign.

Let me walk through the Start Contributing to Babylon.js page and I’ll let you know if I get stuck.

Is there any way to run tests specific to a particular component? - Like shapebuilder?

About Specific tests, let me bring @RaananW into the thread :slight_smile:

Do we have those tests? If we do you can filter tests according to keyword or filename. Are they unit tests? Visualization?

“Do we have those tests?”
Well, that was my question. If I’m modifying ExtrudeShape[Custom] are there specific tests that I should run? It took quite some time to run either the unit or the visualization test set. I can certainly run the entire test sets before I finish, but not sure if that will tell me I didn’t break something.

I think I can reuse the playground to demonstrate that I did what I intended to do, but there is one change I made that seems reasonable, but may have some obscure effect I don’t see; setting the rotated vector to zero unconditionally, to be specific. After looking briefly at the test framework, I don’t think there’s any chance I’ll be able to add a new one - way too much to wade through.

So, if those tests exist either in the package tests (in the “/test” directory in the package you are using) or in the global tests (visualization, for example) which are in tools/tests/test, then yes :slight_smile:

We don’t have unit tests for everything, and we don’t categorize our visualization tests, apart from tagging them with a single string. A GLTF Visualization test might check loaders, GLTF loader, PBR materials, Vectors, and many other components, but it will still be called GLTF Load or something similar.

If you want to add unit tests, we will be happy to review them and merge them :slight_smile: otherwise, running visualization tests is the way to go.

Thanks. At this point, I need get my clone off of the Samba share and see if it will build in Windows, since my linux box is too wimpy.

2 Likes

Raanan, could you go into a little more detail about how to debug a playground snippet? I read the following in the docs, but still don’t understand how to do it, in particular, the ‘add the snippet to the index’ part:

To debug a snippet, run the localhost:1338 server in debug mode and add the snippet to the index. For example:

http://localhost:1338#IQN716#9

do You want to debug the snippet, or BABYLON running the snippet?

The babylon server is running in localhost:1337 (and not 1338). If you see 1338 somewhere in the docs I will be happy to fix it.

To debug the framework running the snipprt, just use the server with the snippet added to its index, just like you wrote (but with 1337). If you want to debug the sniiprt you can do one of the following - either copy the snippet content to createScene.js (which is located in the babylon-server package), or run the playground itself locally as well, but I think this is an overkill just to debug a snippet.

Does this get the snippet from wherever playground.Babylon.com stores it?

Craig

if you save on the playground, it will load it from the snippet server for you