Results 1 to 20 of 22

Thread: Calculate the remaining area of a quadrant with two non overlapping half circles

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Site Admin VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,496
    Location

    Calculate the remaining area of a quadrant with two non overlapping half circles

    Just trying to fill in some time ......

    I have a quadrant with a radius of 6m, which contains two non overlapping half circles. One half circle with a radius of 3m adjoins the horizontal leg of the Quadrant, and the other half circle adjoins the vertical leg of the Quadrant, but starts at the top of the leg and we currently do not know its radius. I am trying to find the balance of the area remaining within the quadrant after calculating the Area of the two half circles.

    Briefly speaking:
    Step 1. Calculate the Area of the Quadrant
    = (Pi()*6^2)/4)
    Step 2. Calculate the area of the HC1 circle (the half circle adjoining the horizontal leg)
     =(Pi()*3^2)/2)
    Step 3. Calculate the area of the HC2 circle (the half circle adjoining the vertical leg)
    ' This is where it gets a little messy. I created a triangle from the center point of the Quadrant to the mid point of HC1 to the mid point of HC2 and returning to the center point of the Quadrant. From this I calculated the length of the upright leg of the triangle and thus the radius of the HC2 circle.

    Step 4. Area remaining = Area of Quadrant -(Sum(HC1 Area & Hc2 Area).

    Providing i got that right (and its up for debate), I decided to push on and attempt to construct a Function.
    Function CalculateQuadrantRemainingArea(QuadrantRadius As Double, HalfCircle1Radius As Double) As Double
        ' Calculates the remaining area of a quadrant with two non-overlapping half-circles.
        ' Half-circle 1 (HC1) is on the horizontal leg from the origin.
        ' Half-circle 2 (HC2) is on the vertical leg from the top of the quadrant.
        Const PI As Double = 3.14159265358979 
        Dim AreaQuadrant As Double
        Dim AreaHC1 As Double
        Dim RadiusHC2 As Double
        Dim AreaHC2 As Double
        Dim RemainingArea As Double
        ' Input validation (optional but recommended)
        If QuadrantRadius <= 0 Or HalfCircle1Radius <= 0 Then
            CalculateQuadrantRemainingArea = CVErr(xlErrValue) 
            ' Return #VALUE! error for invalid input
            Exit Function
        End If
        If HalfCircle1Radius > QuadrantRadius / 2 Then
            ' This scenario implies HC1 diameter is larger than the quadrant radius or it cannot fit fully on the leg from the origin.
            CalculateQuadrantRemainingArea = CVErr(xlErrValue) 
            ' Indicate an impossible scenario
            Exit Function
        End If
        ' Step 1: Calculate the area of the quadrant
        AreaQuadrant = (1 / 4) * PI * (QuadrantRadius ^ 2)
        ' Step 2: Calculate the area of the first half-circle (HC1)
        ' Assuming its diameter spans 2 * HalfCircle1Radius along the leg.
        AreaHC1 = (1 / 2) * PI * (HalfCircle1Radius ^ 2)
        ' Step 3: Determine the radius of the second half-circle (HC2)
        ' Using the non-overlapping (tangency) condition
        ' (r2^2 - 12r2 + 45 = 9 + 6r2 + r2^2) simplifies to 36 = 18r2 --> r2 = 2
        ' In the general case, where C1=(r1,0) and C2=(0,R-r2), we solve:
        ' Sqrt(r1^2 + (R-r2)^2) = r1 + r2
        ' r1^2 + (R-r2)^2 = (r1+r2)^2
        ' r1^2 + R^2 - 2*R*r2 + r2^2 = r1^2 + 2*r1*r2 + r2^2
        ' R^2 - 2*R*r2 = 2*r1*r2
        ' R^2 = 2*R*r2 + 2*r1*r2
        ' R^2 = r2 * (2R + 2r1)
        ' r2 = R^2 / (2 * (R + r1))
        RadiusHC2 = (QuadrantRadius ^ 2) / (2 * (QuadrantRadius + HalfCircle1Radius))
        ' Step 4: Calculate the area of the second half-circle (HC2)
        AreaHC2 = (1 / 2) * PI * (RadiusHC2 ^ 2)
        ' Step 5: Calculate the Remaining Area
        RemainingArea = AreaQuadrant - AreaHC1 - AreaHC2
        CalculateQuadrantRemainingArea = RemainingArea
    End Function
    Attached Files Attached Files
    Last edited by Aussiebear; 07-02-2025 at 02:21 PM.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •