How i can calculate area of polygon with java ??
hello
i've trouble with calculation polygon-area
is there any body who is good at calculation of shapes?
i explain my problem with pictures.
on piture2, i can calculate red-area of polygon with reference "http://www.cs.princeton.edu/introcs/33modular/Polygon.java.html"
but, i can't do it on picture1.
please help me and understand that i'm poor at english
picture 1.
http://myhome.naver.net/imsangchin/trace1.jpg
picture 2.
http://myhome.naver.net/imsangchin/trace2.jpg
Do you have a formula that generates picture 1?
If so, then you can use the basic formula for integration... take very very small steps and sum up all the steps, you can get as close as you like by making the steps sufficiently small.
If you don't have a formula to generate the picture, then you can do it by essentially counting the number of colored pixels in the shape and calling them any type of appropriate units or actually scaling converting them to inches or cm or what ever you are using. You can do this by just scanning across the image and counting how many pixes are on each line, then go to the next line. Do this for the entire image only counting the target color and then do your conversion.
Similar Messages
-
How we can calculate available free memory in java?
Hi all
i want to see what is the free heap memory available while running the java application?
please can anyone tell me how i can do it ?
thank uPerhaps the MemoryUsage class is what you're looking for?
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/MemoryUsage.html -
How i can calculate the backplane speed & throughput of cisco 48 1G 2960S switch?
How i can calculate the backplane speed & throughput of cisco 48 1G 2960S switch?
Disclaimer
The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
Liability Disclaimer
In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
Posting
Calculate? Calculate for wirespeed/line-rate? If the latter, take all the port bandwidths, and assuming they are duplex, double for necessary fabric bandwidth. I.e. 48 gig ports would need a 96 Gbps fabric. Take all your port bandwidths, and allow 1.448 Mpps per gig (for minimum size Ethernet packets), i.e. 48 gig ports would need 69.5 Mpps. Once you have required fabric bandwidth and PPS, you can compare to vendor's specs. -
Hi all,
I planned to develop application that can calculate the area of polygon (with more than 10 points).
I have search on this forum archive and found this source code. but when I implemented that code.
the result is some condition true but other condition is wrong.
public static double calculateArea(Polygon a) {
double area = 0;
for(int i = 0; i < a.npoints-1; i++)
if(i == a.npoints-1) {
area += (a.xpoints*a.ypoints[0])-(a.xpoints[0]*a.ypoints[i]);
else {
area += (a.xpoints[i]*a.ypoints[i+1])-(a.xpoints[i+1]*a.ypoints[i]);
area /= 2;
//if they enter points counterclockwise the area will be negative but correct.
if(area < 0) area *= -1;
return area;
if i passed this polygon the result is correctPolygon a = new Polygon();
a.addPoint(5, 20);
a.addPoint(30, 20);
a.addPoint(30, 30);
a.addPoint(5, 30);
but when i change the order of polygon the result become wrongPolygon a = new Polygon();
a.addPoint(30, 20);
a.addPoint(30, 30);
a.addPoint(5, 30);
a.addPoint(5, 20);
do you have any ide all ?
warm regards,
Stanleyi found the problem, when i read the algorithm. previouse code have some logic error at this part.
for(int i = 0; i < a.npoints-1; i++)should be
for(int i = 0; i <= a.npoints-1; i++)warm regards,
Stanley -
How i can associate my app user with database role
In my application (oracle forms application developed in-house - We are using Oracle Forms 11gR2 with WebLogic 10.3.5 ), i want to use "application user" instead of database user.
I have an application users table, actually, i have database users,and of course, menu application works with database roles (It was developed with oracle forms menu module), my question is, How i can associate my application user with database role, for reusing oracle forms menu funcionality?. It's possible?
Thanks,
Edwarduser8929172 wrote:
In my application (oracle forms application developed in-house - We are using Oracle Forms 11gR2 with WebLogic 10.3.5 ), i want to use "application user" instead of database user.
I have an application users table, actually, i have database users,and of course, menu application works with database roles (It was developed with oracle forms menu module), my question is, How i can associate my application user with database role, for reusing oracle forms menu funcionality?. It's possible?
Hi Edward
You can do this by assigning the role functionality to the application user. For example
create the table to enter user name.
create table to enter group name.
create table to assign user to group.
assign role to group.
assign functionality for the user by coding.
hope this helps -
How we can use forms HTML capabilities with Oracle Applications?
Hi
Could not find any specific doc how we can use forms HTML capabilities with Oracle Applications?
ThanksI'm not sure that I understand exactly what you are asking?
What are you trying to do? If you could give a detailed explanation then we can try and assist.
Reagrds,
Bren -
I lost my iphone, got a new sim card and put it in my boyfriend's old iphone. When I synch it in itunes it will only synch with his stuff and not mine. Any ideas how I can get it to synch with my itunes??
Are you using a Mac? It sounds like you are using his computer to sync to. If this is the case, then it will sync to all of his stuff unless a new user is created with your personal stuff on it.
When you want to sync your iPhone to that computer, switch to your user first, and then everything will sync with your stuff. If he wants to hook up his iPhone to sync it, then he needs to switch back to his own username first. -
How I can calculate tax !
Hi !
I wonder how I can calculate tax !
Now, I'm investigating if i can make MM-Invoice with batch-input,
and i got 1 question.
In making MM-Invoice, I have to decide total invoice amount with tax before going batch-input.
While I could find total amount ( by deal × per amount), I couldn't find how to get amount of tax.
Is there any function module or tables that have tax-rate?check table RBVD
-
How far can text messages be tracked with a court order?
how far can text messages be tracked with a court order?
Hi sherry1234,
Thanks for the excellent question. We are able to provide an average of 3-5 days of text messaging content with a court order.
Thanks,
NidiaA_VZW
Please follow us on Twitter @VZWSUPPORT -
How I can configure my Time Capsule with my mobile me?
Someone know how i can configure my Time Capsule with my mobile me?... Because i need access to my documents remotely, from any place where I find...
(sorry my bad english)I think you're referring to the Back To My Mac feature?
Follow these three articles. Most important are the second and third.
http://www.apple.com/mobileme/features/mac.html
http://support.apple.com/kb/ht1109
http://support.apple.com/kb/HT3486 -
How I can stop the combo box with list of values from fireing validations
Hi I'm using Jdeveloper 11.1.2.3.0
Using Hr Schema employees table
I Display employees data in af:table
and I make List Of values on Department_id filed to easy change the employee department
and another one on Job_id filed
and Imake them UI Hints as ( combo box with list of values ) in the employeesVO
the problem is when I Select a value from department or jobs ( combo box with list of values )
fires the entire filed validations for mandatory atributes
Note : the af:table Property ( contedelivery) is set to (immediate )
How I can stop the combo box with list of values from fireing validationscheck it out.,
http://andrejusb.blogspot.in/2012/09/what-to-do-when-adf-editable-table.html -
I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me
Here's a quick example I threw together that generates a sort-of-bell-curve shaped data distribution, then performs the binning and plotting.
-Kevin P.
Message Edited by Kevin Price on 12-01-2006 02:42 PM
Attachments:
Binning example.vi 51 KB
Binning example.png 12 KB -
How to can i go to settings with out a remote?
How to can i go to settings with out a remote?
If your Apple TV isn't set up to use homesharing, you will need to purchase a new remote.
-
How i can print from my iPad with airport expres
How i can print from my iPad with airport expres
Hi - you would need to purchase a printer that is enabled to print from an iPad, iPhone or iPod - these would include ePrint, iPrint and AirPrint printers - you would then install the appropriate app on you iPad and be able to print - the installation setup for each type of printer would enable you to do this.
-
How I can create a XML file from java Aplication
How I can create a XML file from java Aplication
whith have a the following structure
<users>
<user>
<login>anyName</login>
<password>xxxx</password>
</user>
</users>
the password label must be encripted
accept any suggestionLet us assume you have all the data from the jsp form in an java bean object..
Now you want a xml file. This can be acheived in 2 ways
1. Write it into a file using java.io classes. Say you have a class with name
write("<name>"+obj.getName+</name>);
bingo you have a flat file with the xml
2. Use data binding to do the trick
will recommend JiBx and Castor for the 2nd option
Regards,
Rajagopal
Maybe you are looking for
-
Silly Podcast approval question
Ok this might be a silly question but when I submit a Podcast to my Podcast Producer server and choose to submit for approval it does the work and an email is sent to me telling me that it has been submitted for approval and the path to the files. Th
-
How do i set burn speed in iphoto
i know i can use the finder to burn cd's of photos and i know i can adjust the burn speed in the finder. is there anyway to adjust the burn speed straight from the iphoto app? i keep getting medium disk errors unless i slow the burn speed all the w
-
Start JRA recording programatically
There are small sections of my programs I'd like to profile using JRMC. Is there a way to start and stop inside a program a JRA recording? Erik.
-
ISE backup ignoring subdirectory defined in repository
Greetings, I have a repository configured like this: repository Solarwinds_SFTP_SERVER1 url sftp://server1/ISE/ user ISE password hash <password hash> host-key host server1 When I test with show repository, everything works correctly, I see the
-
When I start up, I get the grey screen, but no OS options (I've been successfully running Win XP via bootcamp for over a year), then Windows DOS tells me that there is a missing/or corrupt system\config file and tells me to put windows setup disc bac