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

  • SEARCH
  • Home
  • 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

I come from a Powerbuilder background. I was recently announced that we change development
I've recently started playing around with the Microsoft Visual Studio Team System Profiler. All
I come from a web-development background. I've been playing around with a bit of
I am having problem with jQuery, which I recently starting playing around with. I
Background info I recently handed in an assigment for my class on algorithms and
Background info: I've recently decided to take on a project of making a social
I recently got into Java. I have a background in dynamic languages and I'm
I've recently been learning vb.net, coming from a background in java and c. I'm
I have made Catifier.com recently, and once the user sets their own background image,
I am from procedure programming background, end up writing TSQL recently with my new

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.