more gears, fast

  • Email
  • Sharebar
  • Email
aplesch's picture

I updated the involute (curved teeth), helical gear generation procedure to use Extrusion rather than IndexedFaceSets. Extrusion automatically supports the back and front faces of the gears, and a smooth appearance by producing a mesh with points shared by triangles. So the logo code could be streamlined and therefore is now much faster generating gears.

However, since extrusions with teeth or other concave corners have some issues with current x3dom, the maximum number of teeth currently is 14. Here is a nice gears mesh with four such helical gears.

The main involute gear profile function remained unchanged but 3d gears are produced as extrusions. Here is the complete logo code for above:

 

And here is mesh with pitch 42 which requires a fix to x3dom which can be dynamically applied, see below.


 

If the front and back face of the large gears do not show, please use this user script with Greasemonkey (install here):

https://gist.githubusercontent.com/andreasplesch/9c7369583dc9f23d6fe7/raw/x3domEarClippingFixer.user.js

Reload the page after enabling the user script.

 

Comments

Andy's picture

ear clipping

Hope x3dom can pull this request soon. I am aware of the concave polygon issue for a long time and very glad to see it is fixed by your earclipping script.  

The involute gear has much smoother gear teeth than my 4-circle gears. Thanks for enriching the contents of VRMath2. 

I noticed that Blender and MeshLab cannot not import extrusion so that could be a down side for extrusion gears. The IndexedFaceSet gears will be still very useful... and I need to add script to remove the duplicate coordinates too.

aplesch's picture

merged

My PR was merged. Since the PR was a bit premature though functional, I submitted a second PR with cleaned up code and some other improvements. It is available as a Greasemonkey user script as well, linked from the PR, and above.

It unfortunate that Blender and Meshlab cannot import extrusion. I guess they do not have a native corresponding object or concept. Since x3dom in effect produces an IndexedFaceSet from the the Extrusion it may be possible to come up with a converter.

The facet optimizing function should pretty much do what you need.

 

Andy's picture

x3dom updated

VRMath2 is now using the x3dom with #576, therefore, the gears above are rendering correctly with both caps.

I have also tested your improved EarClipping in https://github.com/x3dom/x3dom/pull/577 and left a comment there.

Andy's picture

remove duplicate coordinates

I have some options to do so. I can follow your codes after the coordinates of the indexedfaceset was created, or I can check for duplicate coordinates during the creation of indexedfactset (PENDOWN). I am thinking of the later. It may slow down the creation because of checking, but once checked it actually saved time because I only need to update the indicies and not the coordinate points and colors.

Do you know the internal structure of the extrusion in x3dom? There are probably some converters (at least this commercial one http://www.okino.com/conv/imp_vrml.htm) but It will be good if there is an api in x3dom to call.