Sign in to follow this  
MDP Monkey

Arc2

Recommended Posts

Hi guys, I wonder if someone can supply a full working demo of a basic arc2?

It's in the API docs, but it's not clear how to use it. I've tried using a lathe, but I can't get it to work.

I'm using a quadraticBezier at the moment, and it doesn't quite give me the curve I want.

Arc2 seems to be what I need, but as I said there are no code samples or playground examples for me to see the correct use/syntax.

Just a really basic example would be enough for me to start playing with it.

Thanks!

Share this post


Link to post
Share on other sites

Hi MDPM, how ya doon?  I hope well.  Sorry for the slow replies.

You are correct... there's not many demos, and the PG search is being grumpy when trying to search for ""Math.Arc"", too.

I'm going to ping @jerome and see if he can help us do a linesMesh plot of some Arc2's, perhaps using the only PG I could find... a barely-started...

https://www.babylonjs-playground.com/#6G0UJL#0

Jerome is a wizard of plotting-with-math... and a darned nice guy, too.  Hopefully, he (or someone else) can rescue us.  Stay tuned and try to be patient.  thx.

Share this post


Link to post
Share on other sites

Arc2 is used within Path2.addArcTo.

Path2 is a way of producing a 2D shape given x and y coordinates. The path can then be used by PolygonMeshBuilder to draw a polygon based on the path (confusingly in the xz plane)

Path2.addArcTo takes 5 parameters so Path2. addArcTo(midX, midY, endX, endY, numberOfSegments), startX and startY being the previous points in Path2. You cannot start a path with an arc.

Path2 documentation

This PG builds and extrudes two polygons, the top one by giving the corner points of the polygon and th lower one by creating a path2 object. You can see the use of addArcTo in the lower polygon and the curve it produces.

https://www.babylonjs-playground.com/#PTTMVI#1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.