Create an horizontal arc between two positions on the basis of center position

Hello, As a beginner I’m facing few challenges on creating an arced shaped polygon.
I have 3 positions:

let center = {x: 1544099.4685469768, y: 5443842.517738653, z: 2933662.238733839};
let pos1 = {x: 1542979.4544007997, y: 5444544.099535194, z: 2932960.5681547285};
let pos2 = {x: 1543430.2493222232, y: 5443358.603504639, z: 2934910.0218147836};

I want to create a filled semi-circle. I’m using polygon to create semi-circle. Here is the sandcastle link.

It is creating a triangle. But I want to give this triangle’s one edge to be arced in shape. For that I want to calculate the 360 degree circle from center to pos1 and from that circular points just want to get points between pos1 and pos2.

I want to give the edge curved(green arc) as given in the attached screenshot. This edge is horizontal not vertical.

If someone has already done it, please suggest me.

  • Thanks & Regards

For more understanding, I want to create something filled with red color in this screenshot:

I have tried to achieve it. Here is the sandcastle link.

However, it’s not creating a perfect curve but at present my task can be managed by this. If someone has any better solution. Please kindly share.

  • Regards
1 Like

Hi @Jacky,

impressive piece of code you wrote there!
I have just adjusted your code to calculate arcpoints with given angle in a for loop (200 steps)

Sandcastle link

CatmullRomSpline wont create a “even” circle.

Best, Lennart

2 Likes

Hi @lennart.imberg , Thank you so much for showing interest and improving my code.
That’s really a nice idea, rather than creating single midpoint, you’ve created 200 points to create a fine curve.

It could be more perfect if
let numOFsteps = 200;
Replace with:
let numOFsteps = Math.abs(h1-h2);

Coz angle creating in center point can be lesser than contain 200 points.

  • Best Regards,