|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi there,
I have a java program in which i draw a polygon in a JPanel using the Polygon class. I want to calculate the number of pixels in this polygon (or the area of the polygon in pixels). Can anyone please help me on this. I have tried a lot but couldnt find a way to do this. Thanks. Last edited by extreme; 04-09-2007 at 02:27 AM. |
| Sponsored Links |
|
|
|
|||||
|
I believe it has to be a regular polygon for most formulas to work. I remember learning about this in geometry, something about the number of sides minus two... that was in there somewhere. I wish I could remember! Luckily, there's a tool I found online that can help me in sticky situations like this. It's called Google, it's new and I'm loving it. Oh yeah! The apothem! The forumula is area = (Apothem)(Perimeter)/2 Now it's coming back.
Areas and Perimeters of Regular Polygons Regular polygon area formula - Math Open Reference That's the good stuff.
__________________
Funny Stories and Humorous Pictures |
|
|||||
|
A polygon can be chopped into triangles, and use standard formulas for their area.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A polygon's area and volume calculate | rxl_171 | Visual Basic Programming | 5 | 08-08-2007 11:01 AM |
| Number Cloning | Ronin | Java Help | 3 | 12-21-2006 08:23 AM |
| I need to generate a random number in PHP | dirkfirst | PHP Forum | 7 | 07-05-2006 10:58 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |