<p>Thank you for the responses! This solution using quadratic bezier interpolation wound up working for me.</p>
<pre class="lang-python prettyprint-override"><code>def ArcPoints(node):
    points = node.GetAllPoints()
    if len(points) &lt; 3:
        return

    # The first three points of the point object.
    a, b, c = points[:3]

    samples = 6
    arcPoints = list()
    for i in range(samples):
        t = float(i)/(samples - 1)
        # The quadratic bezier interpolation at t.
        p = a * (1-t) ** 2 + b * 2 * (1-t) * t + c * t ** 2
        arcPoints.append(p)

    return arcPoints
</code></pre>

CC BY-SA 4.0
2020-10-16T23:11:27.140Z
This quadratic Bezier curve will not exactly reproduce a circular arc, but only approximate it. To truly represent a circular arch you should use a rational quadratic Bezier curve.
Reynolds
CC BY-SA 4.0
2020-10-16T23:14:18.147Z
@Reynolds Thank you for the reply. How would I do that with three points and an equation in Python?
Dr. Pontchartrain
CC BY-SA 4.0
2020-10-16T23:26:34.293Z
@Reynolds, I found this equation

```CurvePoint = (A*W1*(1-t)^2 + B*W2*2t(1-t) + C*W3*t^2) / (W1*(1-t)^2 + W2*2t(1-t) + W3*t^2)```

My Python interpretation is:
```p = (a * w1 * (1-t) ** 2 + b * w2 * 2*t (1-t) + C * w3 * t ** 2 ) / (w1 * (1-t) ** 2 + w2 * 2*t (1-t) + w3 * t**2)```
Would 2t be 2*t? Do I have the rest correct? Also, what would the weights (w values) be for a circular arc? Thank you.
Dr. Pontchartrain
CC BY-SA 4.0
2020-10-15T22:37:27.460Z
2020-10-15T22:37:27.460Z
Dr. Pontchartrain
<p>One very simple way to do it is to just find the straight line distance between the points A and C. Divide that distance by the number of points you want to subdivide+1. Then starting at A moving along the line formed between A and C add that distance for each subdivision. This gives a nice even subdivision without having to argue with PI.</p>
<p>To get the point on the circle, just take the normalized vector between B and your new point and multiply it by the radius of the circle. The result is a subdivision point on your circle/sphere.</p>
<pre><code>float distanceAC = length(C-A);
float stepLength = distanceAC/(SubdivisionsCount+1); // 4 in this case
vector v = C-A; // gives a vector pointing from A to C
v = normalize(v);
for( int i=1; i&lt;SubdivisionCount+1; i++ ){
     point pointOnLine = A + v*i*stepLength; // Need steplength*i steps along v
     point subdivisionLocation = normalize(pointOnLine-B)*radius;
     // save the subdivision location
}
</code></pre>
<p>This has the plus of being simple, but the negative is that if you want to do to many steps or you want your steps to be extremely accurate, or you want to subdivide over a very large arc, then accuracy suffers.</p>

CC BY-SA 4.0
2020-10-13T19:13:47.390Z
2020-10-13T19:13:47.390Z
pmw1234
<p>Following the instructions from <a href="https://computergraphics.stackexchange.com/a/5918/14079">this post on Stack Overflow</a>, I have been able to find points A, B, and C from points V1, V2, and V3 and a radius value (code below). I would like to be able to find a specified number of subdivisions for the arc section labeled 'Arc B.' Can anyone help me find these position values of these points please?</p>
<p><a href="https://i.sstatic.net/7ntvp.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7ntvp.jpg" alt="Finding Start and End Angles" /></a></p>
<pre class="lang-python prettyprint-override"><code>    r = 106 #radius
    V1 = Vector(50, 100, 0)
    V2 = Vector(100, 300, 0)
    V3 = Vector(350, 350, 0)
    a = V2-V1
    b = V2-V3
    a.Normalize()
    b.Normalize()
    halfang = math.acos((a.Dot(b)))/2
    ab = (a+b)/2
    ab.Normalize()
    A = V2 - r/math.tan(halfang)*a
    B = V2 - r/math.tan(halfang)*b
    C = V2 - r/math.sin(halfang)*ab

</code></pre>

CC BY-SA 4.0
2020-10-13T08:32:49.130Z
Try slerp between BA and BC. https://en.m.wikipedia.org/wiki/Slerp
lightxbulb
<3d><algorithm><computational-geometry><geometry><subdivision>
Rounding a 3D corner with Subdivisions
Dr. Pontchartrain
# Rounding a 3D corner with Subdivisions

(Asked by: username_0 on 2020-10-12)

Following the instructions from [this post on Stack Overflow](https://computergraphics.stackexchange.com/a/5918/14079), I have been able to find points A, B, and C from points V1, V2, and V3 and a radius value (code below). I would like to be able to find a specified number of subdivisions for the arc section labeled 'Arc B.' Can anyone help me find these position values of these points please?

[![Finding Start and End Angles](https://i.sstatic.net/7ntvp.jpg)](https://i.sstatic.net/7ntvp.jpg)

```python
    r = 106 #radius
    V1 = Vector(50, 100, 0)
    V2 = Vector(100, 300, 0)
    V3 = Vector(350, 350, 0)
    a = V2-V1
    b = V2-V3
    a.Normalize()
    b.Normalize()
    halfang = math.acos((a.Dot(b)))/2
    ab = (a+b)/2
    ab.Normalize()
    A = V2 - r/math.tan(halfang)*a
    B = V2 - r/math.tan(halfang)*b
    C = V2 - r/math.sin(halfang)*ab

```

**Tags:** 3d, algorithm, computational-geometry, geometry, subdivision

> **Comments:**
> **username_1**: Try slerp between BA and BC. https://en.m.wikipedia.org/wiki/Slerp  

---

## 2 answers

### Answer by username_0 on 2020-10-15. Score: 0 | Accepted answer

Thank you for the responses! This solution using quadratic bezier interpolation wound up working for me.

```python
def ArcPoints(node):
    points = node.GetAllPoints()
    if len(points) < 3:
        return

    # The first three points of the point object.
    a, b, c = points[:3]

    samples = 6
    arcPoints = list()
    for i in range(samples):
        t = float(i)/(samples - 1)
        # The quadratic bezier interpolation at t.
        p = a * (1-t) ** 2 + b * 2 * (1-t) * t + c * t ** 2
        arcPoints.append(p)

    return arcPoints

```

> **Comments:**
> **username_2**: This quadratic Bezier curve will not exactly reproduce a circular arc, but only approximate it. To truly represent a circular arch you should use a rational quadratic Bezier curve.  
> **username_0**: @username_2 Thank you for the reply. How would I do that with three points and an equation in Python?  
> **username_0**: @username_2, I found this equation  ```CurvePoint = (A*W1*(1-t)^2 + B*W2*2t(1-t) + C*W3*t^2) / (W1*(1-t)^2 + W2*2t(1-t) + W3*t^2)```  My Python interpretation is: ```p = (a * w1 * (1-t) ** 2 + b * w2 * 2*t (1-t) + C * w3 * t ** 2 ) / (w1 * (1-t) ** 2 + w2 * 2*t (1-t) + w3 * t**2)``` Would 2t be 2*t? Do I have the rest correct? Also, what would the weights (w values) be for a circular arc? Thank you.  

---

### Answer by username_3 on 2020-10-13. Score: 0

One very simple way to do it is to just find the straight line distance between the points A and C. Divide that distance by the number of points you want to subdivide+1. Then starting at A moving along the line formed between A and C add that distance for each subdivision. This gives a nice even subdivision without having to argue with PI.

To get the point on the circle, just take the normalized vector between B and your new point and multiply it by the radius of the circle. The result is a subdivision point on your circle/sphere.

```
float distanceAC = length(C-A);
float stepLength = distanceAC/(SubdivisionsCount+1); // 4 in this case
vector v = C-A; // gives a vector pointing from A to C
v = normalize(v);
for( int i=1; i<SubdivisionCount+1; i++ ){
     point pointOnLine = A + v*i*stepLength; // Need steplength*i steps along v
     point subdivisionLocation = normalize(pointOnLine-B)*radius;
     // save the subdivision location
}

```

This has the plus of being simple, but the negative is that if you want to do to many steps or you want your steps to be extremely accurate, or you want to subdivide over a very large arc, then accuracy suffers.


---

