Distance between two pixel in screen
Hi all ,
How can I get the distance between two pixel of the screen .
Thanks and Regards
Anshuman Srivastava
You're welcome. Do spend more time with the API, there are a wealth of methods available in classes like Toolkit, SwingUtilities, Utilities and Robot that help solve many rather obscure problems.
db
Similar Messages
-
Is there any css to vary the distance between two items in apex
Hi,
Is there any css to vary the distance between two items ie two columns horizontally / vertically in apex application at page line level
Regards,
PavanHi ,
I done what u suggested above but i ll tel u clearly
i have name,plot no,street,city,distict,state,country,phone no,pincode items.. i need to align this items like
--------------------------------------------------------------------------main region----------------------------------------------------------------------------
--left region-------------------------------------------middle region------------------------------------------------------right region-------------------
name,___________
plot no,_________
street,________
city,___________ distict,_________
state,__________ country,_________ nothing in it
phone no,__________ pincode_________
to achieve this wat i have to do
Thanks,
pavan -
Shortest distance between two line segments
Hi.
I am looking for the code of the "Shortest distance between two line segments". I would appreciate if anyone has and willing to share.
I can find some in the net but its in VB and i am not familiar with it.
THanks a lot.
regards,There are a couple of things that are not clear:
What determines the rotation speed and lenght of each stick at any given time?
What is the program allowed to do to prevent collision (change speed/direction, change radius, stop everything)
Since you want to prevent collision, you need a predictive algorithm. Once they overlap, the collision has already happened. Too late!
What information does your algorithm get (e.g. r1, r2, theta1, theta2, delta-thetat1, delta-theta2, etc.), i.e. does the program only get static information and need to construct the trajectory from sequential history data or does it get dynamic information about speed and direction?
The trivial answer would be to just keep r1+r2 < distance(P1,P2). This will prevent all "potential" collisions.
LabVIEW Champion . Do more with less code and in less time . -
Finding Distance between two zipcodes with longtitude and latitude
Want to find distance between two zipcodes that have their latitude and longitude stored in a table.
The table is as follows
CREATE TABLE distance (zipcode VARCHAR2, LNG NUMBER, LAT NUMBER)
I couldn't come up with a calculation or understand the mathematical calculation on line.. Can you help me with some stored procedure that will do..?
ThanksThere is no logical complexity in your query besides knowing the basics of
http://en.wikipedia.org/wiki/Spherical_coordinates
Also, the table name "Distance" cannot be more confusing; what you have is essentially "PointsOnSphere".
select R*sqrt(
(sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))* (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))
+
(sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))*
(sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))
+
(cos(pi-p1.lng)-cos(pi-p2.lng))*(cos(pi-p1.lng)-cos(pi-p2.lng))
from distance p1, distance p2
where R is the radius of Earth, and pi=3. Don't forget to convert angular degrees into radiants before you plug in them into the query above
Correction: This was euclidean distance sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2) between the points (x1,y1,z1) and (x2,y2,z2). Spherical distance is
sqrt(
(R*(colatitude1-colatitude2))^2+
(R*sin(colatitude1-colatitude2)*(longtitude1-longtitude2))^2
Message was edited by:
Vadim Tropashko -
How to draw a line(shortest distance) between two ellipse using SWING
how to draw a line(should be shortest distance) between two ellipse using SWING
any help will be appreciated
regardsimport java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
public class ELine extends JPanel {
Ellipse2D.Double red = new Ellipse2D.Double(150,110,75,165);
Ellipse2D.Double blue = new Ellipse2D.Double(150,50,100,50);
Line2D.Double line = new Line2D.Double();
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Color.green.darker());
g2.draw(line);
g2.setPaint(Color.blue);
g2.draw(blue);
g2.setPaint(Color.red);
g2.draw(red);
private void connect() {
double flatness = 0.01;
PathIterator pit = blue.getPathIterator(null, flatness);
double[] coords = new double[2];
double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
double min = Double.MAX_VALUE;
while(!pit.isDone()) {
int type = pit.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
case PathIterator.SEG_LINETO:
Point2D.Double p = getClosestPoint(coords[0], coords[1]);
double dist = p.distance(coords[0], coords[1]);
if(dist < min) {
min = dist;
x1 = coords[0];
y1 = coords[1];
x2 = p.x;
y2 = p.y;
break;
case PathIterator.SEG_CLOSE:
break;
default:
System.out.println("blue type: " + type);
pit.next();
line.setLine(x1, y1, x2, y2);
private Point2D.Double getClosestPoint(double x, double y) {
double flatness = 0.01;
PathIterator pit = red.getPathIterator(null, flatness);
double[] coords = new double[2];
Point2D.Double p = new Point2D.Double();
double min = Double.MAX_VALUE;
while(!pit.isDone()) {
int type = pit.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
case PathIterator.SEG_LINETO:
double dist = Point2D.distance(x, y, coords[0], coords[1]);
if(dist < min) {
min = dist;
p.setLocation(coords[0], coords[1]);
break;
case PathIterator.SEG_CLOSE:
break;
default:
System.out.println("red type: " + type);
pit.next();
return p;
public static void main(String[] args) {
final ELine test = new ELine();
test.addMouseListener(test.mia);
test.addMouseMotionListener(test.mia);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(test);
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
EventQueue.invokeLater(new Runnable() {
public void run() {
Graphics g = test.getGraphics();
g.drawString("drag me", 175, 80);
g.dispose();
private MouseInputAdapter mia = new MouseInputAdapter() {
Point2D.Double offset = new Point2D.Double();
boolean dragging = false;
public void mousePressed(MouseEvent e) {
Point p = e.getPoint();
if(blue.contains(p)) {
offset.x = p.x - blue.x;
offset.y = p.y - blue.y;
dragging = true;
public void mouseReleased(MouseEvent e) {
dragging = false;
public void mouseDragged(MouseEvent e) {
if(dragging) {
double x = e.getX() - offset.x;
double y = e.getY() - offset.y;
blue.setFrame(x, y, blue.width, blue.height);
connect();
repaint();
} -
Distance between two PCIe x 16 slot of P55 GD85
Hello,
Does anyone have an idea what is the clear distance between two PCIe x 16 slot of P55 GD85? planning to get one if my 2 x GTX 285 with modified cooling fan will fit in. each VGA with modified fan is around 55mm in height.
thank you,Exactly, there was no "rude" intention or the will to provoke you behind my previous answer. In fact, I spent 15 minutes to find a ruler in order to measure the port distance on three different ATX Board to make sure I am not telling you anything wrong. I would not have bothered to do that if I had been planning to write a rude reply.
[On the flip side: Personally, I find it kind of rude that you are accusing me of 'rudeness'. However, I suggest we better drop the whole 'who is really being rude here' discussion.]
Quote
The distance between the center lines of two neighbouring slots is always ~ 2.05cm. There are two slots between the PCI-E-x16 slots of the P55-DG85. Simply do the math!
Quote
I am not a mathematician
The distance between the center lines of the two PCI-E-x16-slots of the P55-GD85 is ~6.15cm (there are two more slots in between --> 2.05cm x 3).
This means that this ...
Quote
each VGA with modified fan is around 55mm in height.
... should actually fit. -
Hi folks,
Who knows how I can discover the distance between two selected objects without using neither guides nor grids?
Thanks.How do imagine this would working without using guides or grids? The way I normally do it is:
1. Drag out a guide to point A
2. Drag out a guide to point B
3. Hold shift and put the mouse cursoe between the two -- it shows you the distance
You could also use the measuring tool (click and hold the rectangle tool in the tool pallette.)
Or even just draw a rectangle and look at the width in the property panel. That's a fast and easy method I use sometimes.
Aaron Beall
http://fireworks.abeall.com -
Distance between two GPS points
Is there an inbuilt function in PL/SQL for calulating the distance between two GPS (lat/long) points?
I'm using Oracle 9i. There's a thing called SDO_GEOM available, but I'm not sure if this is what its used for or if it's the best option.If the earth is a complete globe and its circumference is 40000km,
I make the function as follows.
create ore replace
function distance
(a_lat number,a_lon number,b_lat number, b_lon number)
return number is
circum number := 40000; -- kilometers
pai number := acos(-1);
a_nx number;
a_ny number;
a_nz number;
b_nx number;
b_ny number;
b_nz number;
inner_product number;
begin
if (a_lat=b_lat) and (a_lon=b_lon) then
return 0;
else
a_nx := cos(a_lat*pai/180) * cos(a_lon*pai/180);
a_ny := cos(a_lat*pai/180) * sin(a_lon*pai/180);
a_nz := sin(a_lat*pai/180);
b_nx := cos(b_lat*pai/180) * co s(b_lon*pai/180);
b_ny := cos(b_lat*pai/180) * sin(b_lon*pai/180);
b_nz := sin(b_lat*pai/180);
inner_product := a_nx*b_nx + a_ny*b_ny + a_nz*b_nz;
if inner_product > 1 then
return 0;
else
return (circum*acos(inner_product))/(2*pai);
end if;
end if;
end;
I rewrite it by using the factorization and the triangle function's sum and difference formulas:
cos(x-y) = cos(x)cos(y)+sin(x)sin(y)
As result, this function is same to the 1st method of Billy Verreynne.
create or replace
function distance
(a_lat number,a_lon number,b_lat number, b_lon number)
return number is
circum number := 40000; -- kilometers
pai number := acos(-1);
dz number;
dx2y2 number;
inner_product number;
begin
if (a_lat=b_lat) and (a_lon=b_lon) then
return 0;
else
dz := sin(a_lat*pai/180)*sin(b_lat*pai/180);
dx2y2 := cos(a_lat*pai/180)*cos(b_lat*pai/180)*cos((a_lon-b_lon)*pai/180);
inner_product := dz*dz + dx2y2;
if inner_product > 1 then
return 0;
else
return (circum*acos(inner_product))/(2*pai);
end if;
end if;
end;
Message was edited by:
ushitaki -
How to measure distance between two points uisng uiaccelerometer
Hello all,
I am trying to measure distance between two points.So for that i am used uiaccelerometer but its give only rotation changes. I am moving my whole device from one point to another point so for that all x,y & z changes remain same. So how can get the device movement for that?
Thank you..UIAccelerometer does not give rotation changes, it senses acceleration in each of the 3 axis in g-force units. Moving in a plane from one point to another and stopping will result in a net g-force in that axis of zero. To get distance one has to measure the initial acceleration and then the time before a deceleration is detected. It gets really complicated in real life since the start and stop are not instantaneous.
-
Half way pixel between two pixels
hi there guys,
i'm new in this forum
i'm working on this aLife simulation and i need to find co-ordinates of a pixel between two others on an image.
so, pixel A(x1,y1) and pixel B(x2,y2) and suppose there's a line between them
i would need the pixel C(x3,y3) that lies in the exact middle of the distance between these two pixels
i have a function that determines the distance between them but no way of finding out what that half way pixel is
please help cause this is somewhat urgent
thanks in advance for your timeI am sorry, but I took programming in college. What you are asking for is the distance equation, which you should have learned in high school algebra. That equation is simply as follows:
d = sqrt((x2 - x1)^2 + (y2-y1)^2)
where:
"sqrt" means take the square root
d is the distance between the points
The points are (x1,y1) and (x2,y2)
"^2" means to square that portion of the equation
When you are doing a line in a 3-dimensional space, the distance equation becomes the following:
d = sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)
where:
the points are (x1,y1,z1) and (x2,y2,z2)
This is a basic computer programming problem, and if you need to ask on a forum like this for help, maybe you should consider changing majors. (I am not trying to be cruel, but let's face it, there are much more difficult problems you will be presented with in your studies than this one. It does not matter whether you are writing this code with JAI, or without, or with Java, C++, Fortran, COBOL, Perl, or any other language. The logic is the same for this calculation regardless of languages and/or libraries used.) -
Find driving distance between two points without using API by use of Lat & Long?
Using Google geocode API : http://maps.googleapis.com/maps/api/geocode/xml?address=thane&sensor=true
We performed get distance between search criteria entered by user and all related clubs by lat & long stored at db.
2. Two different points such as
(origin: Lat1 & Long1) and (destination: Lat2 & Long2)
We tried for to get distance between these two points,
(Lat2 & Long2) to (Lat1 & Long1)
But distance which we get by calculation is simple straight line distance
Origin Destination
(Lat1 & Long1) (Lat2 & Long2)
3. This is not driving distance as google shows in exact Km
4. For that Google provide another API (distancematrix API)
http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Thane&sensor=true&destinations=khopat&mode=driving&language=en%20-%20EN
5. But there is limit for DistanceMatrix-Service without ClientID and client key
100 elements per query.
100 elements per 10 seconds.
2 500 elements per 24 hour period.
But as element request exceeds it shows : OVER_QUERY_LIMIT error
6. In case of Client ID and Client key
In Distance Matrix 100 000 elements per 24 hour period,a maximum of 625 elements per query and a maximum of 1 000 elements per 10 seconds.
As per this one there is option to get purchase these API but basic question is remain same for us if we are requesting single origin and multiple destination then how element calculation done by google?
But in document google says :
Elements
The information about each origin-destination pairing is returned in an element entry. An element contains the following fields:
Status: See Status Codes for a list of possible status codes.
Duration: The duration of this route, expressed in seconds (the value field) and as text. The textual representation is localized according to
the query's language parameter.
Distance: The total distance of this route, expressed in meters (value) and as text. The textual value uses the unit system specified with the
unit parameter of the original request, or the origin's region.Any information that you see in a google map webpage can be retrieved using the API. The best way of finding the tags on the webpage is to manually perform the query using an IE webpage. Then capture the source and save to a file so you
can use a text editor to look at results. I often on a webpage use the menu : View - Source and then copy the source to a text file.
jdweng -
27" iMac: distance between stand base and screen glass?
I searched high and low, but can't find this info anywhere..
On photos of new 27" iMacs, it looks like the front bottom aluminum part of the screen (with Apple logo on it), became narrower comparing to 24" iMacs. Meaning that screen itself is probably positioned lower than on 24" iMacs (which would be terrific)
I wonder if any of 27" iMac owners could be so kind to put their display in vertical 90 degree position and measure the distance between stand base (the top of the table) and the screen glass? I have attached the picture of the measurement I need.
http://img.skitch.com/20091113-r8w77fdkp3aeetukcnw95g44ya.png
Thanks in advance!I think the answer is 16.3cm. It's the same distance as on the new 21.5" iMacs. I already started a topic myself, asking the same question:
http://discussions.apple.com/message.jspa?messageID=10532444#10532444 -
How to get the distance between two object!!!
I have two GEOM object and want to know the distance between them, may u give me some solution to find the distance between them.
Hi!,
SDO_GEOM.SDO_DISTANCE
see: http://www.oracle.com/technology/documentation/spatial.html
regards, Andreas -
Maintain distance between two objects
hi evryone,
i am trying to develop a simple car game, and to do that i have to maintain the distance between the two wheels.
for the collision detection i have used coreyoneil class, which i think is excellent. i cant get the distances to go smoothly. and basically i am finding it hard to get the physics to work. if anyone has an idea what i should do, or has a good example it would be greatly appreaciated.
i have attached the swf and fla for you to see.
thanks.Basically you can put them together in a sprite, or you might even thing of using box2d or quickbox2d.
if that doesn't work with your setup then you might have a look in here:
http://www.gotoandplay.it/_articles/2004/12/inverseKinematics.php -
Safe distance between two iMacs
How far apart should I keep two iMacs when they are both running? Right now they are set up about a foot apart. Is that a safe distance? Any help will be appreciated. Thanks.
iMac G5 iSight 20", iMac G5 17", Powerbook 12" Mac OS X (10.4.2)Hello,
If you are talking about the iMac G5 or any other LCD screen iMac, then you could safely put them right up against each other with no concern at all. They will not interfere with each other, and no harm will result.
Your most important consideration is ventilation. And, the vents on the iMac G5 and Intel iMacs are on the bottom and the back. And, that's the only area you need to be concerned about when it comes to proximity to other computers. As long as you have about about 6 inches behind the computer (preferably a foot or two) and nothing obstructing the bottom vents, then you should be fine.
The more space you have behind the computer, the cooler it will run. If you reduce airspace behind it, then it will tend to run a little hotter because it will not have as much room to dispose of the hot air. Too little space could cause the hot air to build-up behind the machine, and reduce the effectiveness of the cooling system. Generally speaking, 1-foot / 12-inches is more than adequate.
As for putting the machines side by side, the only possible concern I see there is that you would have to move one of them if you wanted to eject a CD from the drive that is near the other computer.
Now, if you were talking about an older CRT iMac (such as the iMac G3), then you would want more space between the machines. CRT monitors produce an electromagnetic field around them. And, when you place two CRT monitors too close together, you can visually see a ghosting effect on them caused by their proximity to the other monitor.
The specific distance varies by CRT monitor. I've had some that could sit about a foot apart with no noticeable effects. And, I've had others that needed about 2 or 3 feet.
I hope this helps.
Let us know if you have other questions.
P.S., if you'd like, go ahead and click the "Helpful" or "Solved" buttons on any of the posts / replies above if you feel they were helpful or adequately answered your question.
Maybe you are looking for
-
Setting a Default Value in SQL Query Report
Hello: We are using a SQL Query Report to provide a mass update to a table. We are using the apex.collection and having it display a number of records in a SQL Query Report for mass update. We have 14 columns in the report, for which the first 11 are
-
Suddenly can't connect to gmail SMTP for outbound mail
I have both a MacBook Air and an IMac. Recently, I lost the ability on both machines to send outbound mail. With Apple Care help on my supported machine (the MacBook Air,) we rebuilt my gmail mail account on that machine and was able to reconnect and
-
Can iTunes, song files, and library all reside on an external drive?
I loaded iTunes and also all of my music and audiobook folders onto an external drive. There are no iTunes files or song files on my local drive. However, when I try to populate iTunes by importing the music and audio folders iTunes insists on creati
-
Titles missing from location bar dropdown
The page titles and URLs are not displaying in the location bar dropdown that should display the history. The page icons are there on the left, as they normally are, but all the text is missing. I recently had to end the firefox process as my browser
-
Hello, When we are trying to open SLD in PI server ,i got the following error in trace files.Please help me to resolve this problem. defaultTrace_00.9.trc:#1.#00212816975C00130012057400002485008FD81383FDC17E#1290596724425#com.sap.engine.services.serv