Darn centroids!

Needing to find where to put holes in an envelope we needed to find its centre of gravity first. Surprisingly there is a term for that already – a centroid! Well I’ve been lazy and explained all that to ChatGPT and it actually came back with a very sensible set of answers which I compiled into following.

Image showing a traverse truss with jigs for passing through the envelope.

Finding the Centroid of a Composite Shape: Half-Ellipses and a Rectangle

In this post, we’ll explore how to find the centroid of a composite shape made up of two half-ellipses and a rectangle. This process involves both analytical and graphical methods to ensure accuracy and clarity.

Step 1: Centroid of a Half-Ellipse

For a half-ellipse with the semi-major axis aaa and semi-minor axis bbb, the centroid (xˉ,yˉ)(\bar{x}, \bar{y})(xˉ,yˉ​) is given by:

  • xˉ=0\bar{x} = 0xˉ=0
  • yˉ=4b3π\bar{y} = \frac{4b}{3\pi}yˉ​=3π4b​

Step 2: Centroid Calculation for Given Shapes

Given two half-ellipses:

  • First half-ellipse with a=−3a = -3a=−3 and b=1b = 1b=1
  • Second half-ellipse with a=1.5a = 1.5a=1.5 and b=1b = 1b=1, centered at (2,0)(2,0)(2,0)

For a horizontally sliced half-ellipse:

  • First half-ellipse centroid: (0,43π)(0, \frac{4}{3\pi})(0,3π4​)
  • Second half-ellipse centroid: (2,4×13π)(2, \frac{4 \times 1}{3\pi})(2,3π4×1​)

Step 3: Centroid of a Rectangle

For a rectangle with coordinates starting at (0,−1)(0, -1)(0,−1) and ending at (2,1)(2, 1)(2,1):

  • Centroid: (xˉ3,yˉ3)=(0+22,−1+12)=(1,0)(\bar{x}_3, \bar{y}_3) = \left(\frac{0 + 2}{2}, \frac{-1 + 1}{2}\right) = (1, 0)(xˉ3​,yˉ​3​)=(20+2​,2−1+1​)=(1,0)

Step 4: Composite Shape and Its Centroid

To find the centroid of the composite shape consisting of the two half-ellipses and the rectangle:

  1. Calculate the areas (weights) of each shape:
    • Half-Ellipse 1: A1=12π×3×1=3π2A_1 = \frac{1}{2} \pi \times 3 \times 1 = \frac{3\pi}{2}A1​=21​π×3×1=23π​
    • Half-Ellipse 2: A2=12π×1.5×1=1.5π2=0.75πA_2 = \frac{1}{2} \pi \times 1.5 \times 1 = \frac{1.5\pi}{2} = 0.75\piA2​=21​π×1.5×1=21.5π​=0.75π
    • Rectangle: A3=2×2=4A_3 = 2 \times 2 = 4A3​=2×2=4
  2. Find the centroids of each shape:
    • Half-Ellipse 1: (xˉ1,yˉ1)=(−4π,0)(\bar{x}_1, \bar{y}_1) = \left(\frac{-4}{\pi}, 0\right)(xˉ1​,yˉ​1​)=(π−4​,0)
    • Half-Ellipse 2: (xˉ2,yˉ2)=(2+2π,0)(\bar{x}_2, \bar{y}_2) = \left(2 + \frac{2}{\pi}, 0\right)(xˉ2​,yˉ​2​)=(2+π2​,0)
    • Rectangle: (xˉ3,yˉ3)=(1,0)(\bar{x}_3, \bar{y}_3) = (1, 0)(xˉ3​,yˉ​3​)=(1,0)
  3. Compute the weighted average of the centroids:
    • Total area: A1+A2+A3=3π2+0.75π+4=9π4+4A_1 + A_2 + A_3 = \frac{3\pi}{2} + 0.75\pi + 4 = \frac{9\pi}{4} + 4A1​+A2​+A3​=23π​+0.75π+4=49π​+4
    • Centroid of the composite shape: xˉ=A1⋅xˉ1+A2⋅xˉ2+A3⋅xˉ3A1+A2+A3=3π2⋅−4π+0.75π⋅(2+2π)+4⋅19π4+4≈0.3806\bar{x} = \frac{A_1 \cdot \bar{x}_1 + A_2 \cdot \bar{x}_2 + A_3 \cdot \bar{x}_3}{A_1 + A_2 + A_3} = \frac{\frac{3\pi}{2} \cdot \frac{-4}{\pi} + 0.75\pi \cdot \left(2 + \frac{2}{\pi}\right) + 4 \cdot 1}{\frac{9\pi}{4} + 4} \approx 0.3806xˉ=A1​+A2​+A3​A1​⋅xˉ1​+A2​⋅xˉ2​+A3​⋅xˉ3​​=49π​+423π​⋅π−4​+0.75π⋅(2+π2​)+4⋅1​≈0.3806
    • yˉ=0\bar{y} = 0yˉ​=0

Visualization

Below is the graphical representation of the composite shape along with the calculated centroid and cut points.

import matplotlib.pyplot as plt
import numpy as np

# Weights and centroids
W1 = 12.57
W2 = 6.0
d = 6 / np.pi + 2

# Coordinates of centroids
x1, y1 = 0, 0
x2, y2 = d, 0

# Centroid of composite shape
bar_x = 0.3806
bar_y = 0

# Points A and B
point_A = (-0.6194, 0)
point_B = (1.3806, 0)

# Define rectangle
rect_x = [0, 2, 2, 0, 0]
rect_y = [-1, -1, 1, 1, -1]

# Plot the shapes and points
plt.figure(figsize=(10, 6))

# Half-ellipses
theta = np.linspace(-np.pi/2, np.pi/2, 100)
x1 = 3 * np.cos(theta)
y1 = 1 * np.sin(theta)
x2 = 1.5 * np.cos(theta)
y2 = 1 * np.sin(theta)
cx1, cy1 = 0, 0
cx2, cy2 = 2, 0
plt.plot(cx1 - x1, cy1 + y1, label='Half-Ellipse 1 (a=-3, b=1)', color='blue')
plt.plot(cx2 + x2, cy2 + y2, label='Half-Ellipse 2 (a=1.5, b=1)', color='green')

# Rectangle
plt.plot(rect_x, rect_y, label='Rectangle', color='red')

# Centroid
plt.scatter(bar_x, bar_y, color='purple')
plt.text(bar_x, bar_y, 'Centroid', fontsize=12, ha='right', color='purple')

# Points A and B
plt.scatter(point_A[0], point_A[1], color='orange')
plt.text(point_A[0], point_A[1], 'Point A', fontsize=12, ha='right', color='orange')
plt.scatter(point_B[0], point_B[1], color='orange')
plt.text(point_B[0], point_B[1], 'Point B', fontsize=12, ha='right', color='orange')

# Formatting
plt.xlim(-4, 4)
plt.ylim(-1.5, 2)
plt.axhline(0, color='black', linewidth=0.5)
plt.axvline(0, color='black', linewidth=0.5)
plt.grid(color='gray', linestyle='--', linewidth=0.5)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Graph of Two Half-Ellipses with a Rectangle, Centroid, and Cut Points')
plt.legend()
plt.show()

This Python code generates the visual representation of the two half-ellipses, the rectangle, the calculated centroid, and the cut points. It ensures the correct understanding of the composite shape and its centroid.

By following these steps and using both analytical and graphical methods, we can accurately determine the centroid of a composite shape consisting of multiple geometric figures. This approach is essential in various engineering and design applications where precision is crucial.

Long story short, Point A (rear hole) can be found (−0.6194, 0) and Point B at (1.3806,
0). Now just to cut those it should be working! (Well, apparently when rotating these 2D shapes around the Y-axis to form 3D solids, the centroid positions might change due to the added dimension. So we can be off a little, but shouldn’t be too far and we can still compensate with ballast.)

Current envelope stage

One thought on “Darn centroids!

Leave a comment