Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 219389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:50:24+00:00 2026-05-11T18:50:24+00:00

Background : I was recently playing around with GDI+ to draw a Disc displaying

  • 0

Background:

I was recently playing around with GDI+ to draw a “Disc” displaying a sweeping color change through 360 degrees. (I dug up some HSL to RGB code to loop through HSL(1,1,1) -> HSL(360,1,1))

Regarding the disc, I first drew a full solid circle using the above, and then a second circle in Grey over the center to give the following

alt text

So this is all fine… but I realised that GDI+ is insulating us from a lot of the tricky match that’s going on here by way of the FillPie method. Also, FillPie requires you to supply a bounding rectangle for the pie as opposed to a Radius Length. It also does a full segment fill and doesnt allow you to specify a part of that segment only.

Question:

Can anyone point me in the direction of some Math functions or give any explanation on what forumla I would need to calculate the area & plot points of the following “Green Filled Area” given:

Point `c` - an x,y co-ordinate
Angle `A` - an angle from horizontal
Angle `B  - an angle from horizontal where `B` - `A` == the sweep angle
Length `r` - a distance from `c`
Length `r2` - a distance from `c` where `r2` - `r` == the `height` of the segment to be filled.

alt text

Links to Math sources are fine but I’ve had a quick google & look at Wolfram Math and could find what I was looking for. Also, if there was some way to generate a sequence of bounding (x,y) co-or’s that could be passed as a Point[] to Graphics.FillPolygon, that’d be cool too.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:50:25+00:00Added an answer on May 11, 2026 at 6:50 pm

    The area is the difference of the outer and inner disc parts. The area of a disc part is proportional to the angle sweep:

    area = (b-a)*((r+r2)^2-r^2)/2
    

    a and b must be expressed in radians.
    For b-a = 2*Pi, area = Pi*(r+r2)^2 - Pi*r^2 is the difference of the areas of the outer and inner discs.

    You can generate points on the inner / outer circle using

    x = cx + r * cos(t)     /     x = cx + (r+r2) * cos(t)
    y = cy + r * sin(t)     /     y = cy + (r+r2) * sin(t)
    

    Where t varies from a to b.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: Recently while looking at a structured text editor I noticed they used a
Background: I have a little video playing app with a UI inspired by the
I've been recently playing with WPF and I've come across a number of problems
Background I recently joined a small start-up after working at a large company. I'm
I have C# background and been working with C# for so many years.. Recently,
Ok, I recently implemented a background worker to perform saving and loading of data.
I have a PHP script that launches another script in the background. Recently my
I have just started playing around with using Dojo in Zend Framework and things
Background Recently I've started to use XML a lot more as a column in
I'm coming from a PHP/Python/Javascript background, and recently became very interested in Scala -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.