Cartesian Coordinates

Ok, let me start by saying that I am really really new to Java programming. For my first coding project (outside of the tutorials) I want to create a 2D Cartesian map. I am at a loss though of where to go next.
The class I built to hold the user given information is:
public class GridParameters{
/* These variables are going to be used to generate the first layer of the
* program, the grid. For testing purposes the grid origins can be 0,0 with
* rotation of zero. The scale MUST be greater than 0!*/
public int originEasting = 0;
public int originNorthing = 0;
public int gridRotation = 0;
public int gridScale = 1;
Ok... so I guess the first question is: How do I get the user information from the form I created, into these fields? And the second: How would I get the grid displayed on the screen? I know these are broad broad questions, but like I said, I am really new, and just looking for a nod in the right direction.

Stop, and do this tutorial right now: http://java.sun.com/docs/books/tutorial/2d/index.html

Similar Messages

  • How can I use FlexMotion vector move function for cartesian coordinate system to other coordinate.

    I have problem with convesion from cartesian coordinate system to other one. I need use standard move function for example blend to moving 2 arms manipulator. What i need to do?

    The vector move will probably not give the results you are looking for. The vector move calculates the trajectory based on unit vectors in cartesian space. For a 2 arm robot (ex. 2 rotation joints), you would be able to move from point A to point B as desired, however the path would not be a straight line. The path may also not be suitable for the mechanism, which could cause a collision or maybe a singularity.
    The best solution is probably the contour move. You can use the inverse kinematic routine you wrote and send the results to a contour move. Contour moves are a little more complicated to use than the simple one axis or vector moves, however they are also much more flexible. I do not know of any functions already written for your system,
    but it sounds like you are already on the right path.
    Regards,
    Brent Runnels
    Applications Engineer
    National Instruments

  • Change polar data to cartesian coordinates

    The txt file is the data get form 2D laser rangefinder, which every 1°capture a obstacle distance information and 180 data in total. Obviously,this is under polar coordinate system.
    first,I would like to change the log file's data under polar coordinate to cartesian coordinates by multiply sin(theta) and cos(theta).second,the result data form 2D array,and then conbine another array which is 1D zero array to form a 3D array.Please tell me how to realize it.
    Thanks
    Attachments:
    01.txt ‏2 KB

    You don't need any trigonometry, just go via complex numbers. Attached is one simple possibility. (note that LabVIEW 8.0 has a single tool to go from "r,theta" to "x,y" in the complex palette). See attached, LabVIEW 7.0.
    You might need to tweak it for the desired definition of the angles (ccw vs. cw)
    Alternatively, there is also a 1D polar to rectangular tool in the "math.. array operations" palette that you could use, just create a ramp for theta and initialize a zero array for Z.
    Message Edited by altenbach on 06-30-2006 12:07 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    rangefinder.vi ‏43 KB

  • Single Precision "3D Cartesian Coordinate Rotation (Direction) (Array)"

    Hi there
    I am using "3D Cartesian Coordinate Rotation (Direction) (Array).vi" but this VI used Double Precision XYZ numbers.
    Is there equivalent in Single Precision?
    My reason is to save memory space and time. I am already using 64-bits LabVIEW  with 16 GB or RAM.
    LabVIEW 2013
    Thank you
     Peter

    No, unfortunately LabVIEW provides very few Single Precision VIs (see my idea here).  You might have success by reimplementing it yourself (it's just a matrix multiplication - look in the Help), and using the Multicore Analysis and Sparse Matrix Toolkit which does provide both SGL and DBL paralellized forms of most of the Linear Algebra VIs, among other things.

  • 2D Cartesian Coordinate Rotation bug?

    I am seeing unusual behaviour in a program I'm working on.
    When performing a 2D cartesian rotation, normally things are fine but when I feed it X and Y arrays with zero elements, it seems to "remember" the last set of data sent to it and outputs basically the last set of data instead of size zero arrays.....
    Can anyone reproduce this?  Is this fixed in later versions? I'm using LV 8.2.1, and can't use a different version because the customer insists on it.
    Shane.
    Message Edited by Intaris on 08-12-2008 07:55 AM
    Say hello to my little friend.
    RFC 2323 FHE-Compliant
    Attachments:
    2D Rotate bug.png ‏2 KB

    Shane, I can fully reproduce this in LabVIEW 8.5.1, so I think it is a bug.
    Such a VI should NOT output stale data if the inputs are empty arrays!
    Attached is a demonstration of the problem and workaround using complex math.
    (I strongly prefer using complex data for xy graph. It is so much cleaner. )
    Message Edited by altenbach on 08-12-2008 12:22 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RotateBug.png ‏14 KB
    2d_Rotate_bugMOD.vi ‏23 KB

  • How can I get the X and Y coordinates of an object in Xcode, ApplescriptObjc?

    How can I get the value of a specified object's X and Y coordinates in Xcode, using ApplescriptObjc? I'm hoping for something like:
    myObject's currentPosition()
    // Which would return {150, 100} for the X and Y of that object.

    Actually this is straight from basic physics
    Assuming that the x and y values you get using that AppleScript/Objective-C code is accurate, to move the object you would do
    set x to x + dx * speed
    set y to y + dx * speed
    with dx and dy being an integer with a value of -1 or 1 which indicates the direction the object is moving. Remember the origin in OS X is the middle of the frame or screen with positive x and y values moving to the upper right quadrant, and negative x and y values moving to the lower left. Your basic Cartesian coordinate system. Speed is also an interger and models the speed of the object.
    Once you've set x and y to their new values you would write  them back to the object.
    This is so I can find how much distance (in pixels) is being travelled when I animate an object to move from one position to another, to apply it to my desired velocity (of pixels per second), to find out how long the object should take to move.
    This part has got me stumped.
    To make an object move you need to change its x and y coordinates. To get smooth animation you need to change them on a regular schedule at a rate fast enough to avoid jerky motion. Given the refresh rate of most monitors and other factors a rate of 60 times per second gives good results. Between each tick of the clock you change the x and y coordinates by some amount, the size of the amount will model speed. Add a small change and the object moves slowly, add a big amount and the object moves quickly. Keep the amount of change constant and the object will move at a constant speed. Increase (or decrease) the amount of change between each tick and the object will accelerate (or decelerate)

  • 2D Coordinate Transformation

    Hello, I was hoping someone could help me with my current problem. I have two sets of 2D Cartesian coordinates. The first set gives the locations of points in a regular grid. The second set gives locations of points in a distorted grid - it may be offset, rotated, skewed etc compared to the regular grid.
    If the points in the two data sets match up (i.e. the first point in the distorted grid corresponds to the first point in the regular grid), how could I map between the two data sets?
    The ultimate aim is to be able to determine which four known points from the distorted data set surround an arbitrary point, and then use the mapping between the distorted and regular points to transform the coordinates for that arbitrary point into the regular coordinate system.
    I just can't figure out how to do the mapping, I've tried using a Labview program that used the solve linear equations VI but that was treating the x and y coordinates as independent and it failed to map properly if, for example, a square in the regular grid was a trapezium in the distorted grid.
    Does anyone have any ideas on how to solve this?
    Thanks in advance,

    Ok, I think I have this working. The transformation is described in the fourth post here (click) if anyone else needs it.

  • Recording pixel/dot coordinates in CS5 extended?

    Hi all,
    I'm a Photoshop novice, and I'm wondering if there's any way to automatically record the coordinates of a color selection using the measurement and selection tool features. 
    For example, if I look at a photo over which a layer has been drawn containing nothing but colored dots, I would like to be able to somehow record the individual location (a la a cartesian coordinate system) of each one of those dots.  I know that the Info bar tracks mouse location, but ideally I'd like to automate the recording of these multiple locations.  I know how to count the number of these dots, but knowing exactly where they lie on the Photoshop image grip would be invaluable.
    I'll be happy to provide more information if it's necessary - I'm also wondering if Illustrator has a function that might be able to help me. 
    Thanks in advance!

    I thought of one way, but it does require some manual work.
    Try this:
    1.  Click Edit - Preferences - General.
    2.  Check the History Log setting.
    3.  In that same section set Metadata and Edit Log Items: Detailed.
    4.  [OK] to exit the dialog.
    5.  Choose the Color Sampler tool from the Tools panel.
    6.  Click on the image to put a sampler on each of the pixels you want to identify.  You might have to zoom in to get this done accurately.
    7.  Choose File - File Info, History tab, and note that the locations of the samplers are listed.
    -Noel

  • Plotting cartesean coordinates in java

    im trying to draw a line using cartesean coordinates(junction of x and y axis are (0, 0). but javas coordinates are different.
    is there a way of converting these coordinates in java cordinates so that i can draw the line.
    thnx

    java coordinates start in the top left at (0, 0)
    if the graph is 200 x 200 big, the center coordinates
    are (100, 100)(java coordinates) but for cartesean to
    work i need to have the center of the graph as (0, 0)As CeciNEstPasUnProgrammeur said, add the offset. But, for y, you need a negation, too--because your Cartesian coordinates get larger as you go toward the top of the screen, which is the opposite of Java's coordinates.
    JavaScreenX = GraphX + 100;
    JavaScreenY = 200 - (GraphY + 100) = 100 - GraphY

  • Central Slice Theorem for 2D FFT

    DO anyone know how to apply 2D Central slice theorem for 2D  Fourier Transformed Image? FOr this forst we need to mapp the samples of FT in Cartesian coordinate system to Polar.
    Can anyone help with this?
    Nghtcwrlr
    ********************Kudos are alwayzz Welcome !! ******************

  • How can I get the rotation information of my wrists in Kinect for Windows v2 ?

    Hi,all
    Assuming we make human wrist as the coordinate origin point of a three-dimensional space Cartesian coordinate, then when moving the wrist freely, what is the wrist rotation information in the coordinate system? Can kinect V2 describe it just like the degree
    of roll, pitch and yaw in Face Basics demo given in the V2 SDK Browser?
    Based on Kinect Studio 2.0 on 3D View model, it gives a vector arrow at each joint in real time, when I move, the direction of arrows changes correspondingly. So I think this may help me to get the information I want.  
    Here are my questions:
    1. Could I use Kinect V2 SDK to detect and output this information directly? If not, any suggestion to use the data which SDK output to get rotation information?    
    2. If the Q1 answer is yes, what is the accuracy of the sensor about the degree of roll, pitch and yaw on wrist?
    3. I have read Kinect V2 SDK documentation about the body class, the JointOrientations property description says that "the joint orientations of the body", what I want to know is the joint orientation based on
    what frame of reference? The specific value of body.JointOrientations looks what kind of data?
    Any advise or guidance would be greatly
    appreciated. 

    Thanks Carmine. It's really helps. But I still have some questions to ask.
    As you said "a quaternion value, where the
    Y component rotation is around the direction vector from the parent",and you also said "The
    orientation value is ...not the rotation from the parent",my English is poor so I am a little bit confused. 
    About the accuracy, What is the level of accuracy under ideal conditions?
    And in what circumstance
    that "value could be 180 rotated" thing could happen?
    Thank you for your time

  • Need to isolate error with output with valid input (code included)

    Hey guys, this code will be a bit lengthy as I am posting from two separate Java files: Rectangle.java and RectangleTest.java - Basically I am stumped as to why even valid input keeps resulting in this message: System.out.println("\nThis is a SQUARE, not a Rectangle...Quiting...\n"); . Why am I getting this output? I seriously cant figure this out, and really what I am trying to do is take user input for four sets of coordinates, store them, do some simple math with them to determine if the object they form is a Rectangle and not a square. In the long run I am probably doing the whole thing wrong.
    Here is the Rectangle.java code:
    public class Rectangle {
         private int x1,x2,x3,x4,y1,y2,y3,y4;
         private int length;
         private int width;
         public Rectangle ()
              this.x1 = 0;
              this.y1 = 0;
              this.x2 = 0;
              this.y2 = 0;
              this.x3 = 0;
              this.y3 = 0;
              this.x4 = 0;
              this.y4 = 0;
         public Rectangle ( int x1, int x2, int x3, int x4, int y1, int y2, int y3, int y4)
              this.setX1(x1);
              this.setX2(x2);
              this.setX3(x3);
              this.setX4(x4);
              this.setY1(y1);
              this.setY2(y2);
              this.setY3(y3);
              this.setY4(y4);
              // First set x1, y1
              if (x1 > 0 && x1 < 20)
                   setX1(x1);
              else
                   this.x1 = 0;
              if (y1 > 0 && y1 < 20)
                   setY1(y1);
              else
                   this.y1 = 0;
              // Second set x2,y2
              if (x2 > 0 && x2 < 20)
                   setX2(x2);
              else
                   this.x2 = 0;
              if (y2 > 0 && y2 < 20)
                   setY2(y2);
              else
                   this.y2 = 0;
              // Third set x3,y3
              if (x3 > 0 && x3 < 20)
                   setX3(x3);
              else
                   this.x3 = 0;
              if (y3 > 0 && y3 < 20)
                   setY3(y3);
              else
                   this.y3 = 0;
              // Last set x4,y4
              if (x4 > 0 && x4 < 20)
                   setX4(x4);
              else
                   this.x4 = 0;
              if (y4 > 0 && y4 < 20)
                   setY4(y4);
              else
                   this.y4 = 0;
         }// exit constructor
         // Enter methods
         public int getArea()
              return length * width;
         public int getPerimeter()
              return (2*length) + (2*width);
         public boolean isSquare()
              if (length == width)
                    return true;
              else return false;
         public boolean isRectangle()
              if (length != width && length > width)
                    return true;
              else return false;
         // Enter Setters and Getters
         public void setLength(){
              this.length = ((x2-x1)^2 + (y2-y1)^2);
         public int getLength(){
              return length;
         public void setWidth(){
              this.width = ((x4-x1)^2 + (y4-y1)^2);
         public int getWidth(){
              return width;
         public void setX1(int x1) {
              this.x1 = x1;
         public int getX1() {
              return x1;
         public void setX2(int x2) {
              this.x2 = x2;
         public int getX2() {
              return x2;
         public void setX3(int x3) {
              this.x3 = x3;
         public int getX3() {
              return x3;
         public void setX4(int x4) {
              this.x4 = x4;
         public int getX4() {
              return x4;
         public void setY1(int y1) {
              this.y1 = y1;
         public int getY1() {
              return y1;
         public void setY2(int y2) {
              this.y2 = y2;
         public int getY2() {
              return y2;
         public void setY3(int y3) {
              this.y3 = y3;
         public int getY3() {
              return y3;
         public void setY4(int y4) {
              this.y4 = y4;
         public int getY4() {
              return y4;
    Code for RectangleTest.java:
    import java.util.Scanner;
    public class RectangleTest {
         public static void main(String[] args)
              int choice;
              int xFirst, xSecond, xThird, xFourth, yFirst, ySecond, yThird, yFourth;
              Scanner input = new Scanner(System.in);  // Scans or reads the inputs from the keyboard of user
              do {
                   System.out.print("\nTo START Enter '1'; ");
                   System.out.print("\nOr to QUIT Enter '0'; ");
                   choice = input.nextInt();
                   if (choice == 1)
                  // First Set
                  System.out.println("\nPlease enter the FIRST set of Coordinates\n");
                  System.out.print("Enter X1: ");
                  xFirst = input.nextInt();
                  System.out.print("Enter Y1: ");
                  yFirst = input.nextInt();
                  // Second Set
                  System.out.println("\nPlease enter the SECOND set of Coordinates\n");
                  System.out.print("Enter X2: ");
                  xSecond = input.nextInt();
                  System.out.print("Enter Y2: ");
                  ySecond = input.nextInt();
                  // Third Set
                  System.out.println("\nPlease enter the THIRD set of Coordinates\n");
                  System.out.print("Enter X3: ");
                  xThird = input.nextInt();
                  System.out.print("Enter Y3: ");
                  yThird = input.nextInt();
                  // Third Set
                  System.out.println("\nPlease enter the FOURTH set of Coordinates\n");
                  System.out.print("Enter X4: ");
                  xFourth = input.nextInt();
                  System.out.print("Enter Y4: ");
                  yFourth = input.nextInt();
                  // Instantiating the Rectangle class to test it
                  Rectangle rectangle1 = new Rectangle(xFirst, xSecond, xThird, xFourth, yFirst, ySecond, yThird, yFourth);
                  int lengthRectangle1 = rectangle1.getLength();
                  int widthRectangle1 = rectangle1.getWidth();
                  int area = rectangle1.getArea();
                  int periRect = rectangle1.getPerimeter();
                  // Check Shape type
                  if (rectangle1.isRectangle())
                       System.out.println("\nThis is a valid Rectangle\n");
                  else if (rectangle1.isSquare());
                        System.out.println("\nThis is a SQUARE, not a Rectangle...Quiting...\n");
         }while (choice != 0);
         System.out.println("Bye for now!");
    }

    NPP83 wrote:
    Essentially, I am trying to achieve the following:
    1. Store the Cartesian coordinates for the four corners of a Rectangle
    2. Verify that the supplied coordinates (by the user) do infact make a Rectangle and not a Square.
    Since I don't physically have a Length and Width, but just points, I have to use a little math to create a Length and Width and I came up with ((x2-x1)^2 + (y2-y1)^2) to find the length of one side. I thought I would store this as the way to set the Length/Width (setLength & setWidth), but I havent been able to find a way to bridge the user's input in the main() method of the test program to use the values in this formula. Even then, I am not sure if this simple step would at all help validate the object created by the four sets of points is a Rectangle. I thought that a Rectangle might be created by simply by deductive math where if the Length > Width or Length < Width and Width != Length then I would have a what I was looking for.One side is (X2 - X1) the next side is (Y3 - Y2) the 3rd and 4th sides are: (X4 - X3) and (Y4 - Y1).
    Edited by: morgalr on Mar 29, 2010 3:40 PM -- the following comment added:
    You should check out getBounds, it may be what you are looking for.

  • Very Basic Objective-C issue, I am sure

    So I picked up a book on ojective-c namely Mr. Kochan's, and have been trying to work through the exercises and examples. I ran into my first problem that I haven't been able to solve myself. The error says that the object I tried to create "point" is being redeclared as a different type of symbol. Although I can swear I have the section from the book copied almost verbatim, I am sure I am doing something overtly wrong, but I still can't find it. Any suggestions would be greatly appreciated.
    Thanks in advance!
    Here is the code I am working with sans the header:
    #import <stdio.h>
    #import <objc/Object.h>
    //--------------Interface Section----------
    @interface Point: Object
    int hcoord;
    int vcoord;
    -(void) print;
    -(void) setHcoord: (int) x;
    -(void) setVcoord: (int) y;
    @end
    //-------- Implementaion Section-------------
    @implementation Point;
    -(void) print
    printf (" %i,%i", hcoord, vcoord);
    -(void) setHcoord: (int) h
    hcoord = h;
    -(void) setVcoord: (int) v
    vcoord = v;
    @end
    //--------- program section------------
    int main (int argc, char *argv[])
    Point *point1 = [[Point alloc] init];
    [point1 setHcoord: 4];
    [point1 setVcoord: 5];
    printf ("The cartesian coordinates for point 1 are:");
    [point1 print];
    printf ("\n");
    [point1 free];
    return 0;
    12" Powerbook   Mac OS X (10.4.7)  

    OK. I think I see what's going on. Point is already declared in the Core Foundation, which is included in your project. If you're following the directions on page 10 of Kochan's book, they're kind of out of date.
    I can get your program to build and run if I follow these steps:
    1. Create a new project in Xcode. But instead of choosing a "Cocoa Application" like the book says, scroll down to the section that says "Command Line Utility". You want a "Foundation Tool".
    2. In your "Source" folder in Xcode, you'll see two files, one with ".m" on the end, the other with "Prefix.pch" at the end. Open the ".m" file and replace everything with your code. Close and save the ".m" file.
    3. Now, open the other file (the one ending with "_Prefix.pch" in your "Source" folder. There is a comment at the top, then three lines:
    <pre class="command">#ifdef _OBJC_
    #import <Foundation/Foundation.h>
    #endif</pre>Comment out those three lines like so:
    <pre class="command">//#ifdef _OBJC_
    // #import <Foundation/Foundation.h>
    //#endif</pre>Your project should compile and run. Alternatively, since Point is already defined, you can just change the name from Point something else.
    Instead of step 3 above, just replace Point with something like MyPoint. Even just changing the "P" to a lower case "p" is enough to fix it.
    charlie
    P.S. -- If you haven't already visited, I suggest checking out Steve Kochan's page for that book. Pay special attention to the Errata section. There are some errors in the book and the corrections are there, so that's a good resource.

  • The Document's size and its limitation

    What is the max size of width and height in all measurement (Points, Picas, Inches, Milimeters, Centimeters, Pixels) when you create a new document? I would like it to use it together with cartesian coordinate system and ruler.
    My request is to have a big size so much as possible!

    227.54" is the maximum dimension in Illustrator.
    If you need  bigger create your doucment at for example half scale and print at 200%.

  • Width tool

    Why is it when using  the width tool and after you expand the stroke, there's tons of anchor points? I understand that the anchors follow the path but it's got a ton of anchors which make it impossible to clean up. What's the ideal way to clean up all these anchors?  ( sorry not the smooth tool or the simplify tool, something more precise perhaps?)
    My second question is how can you make strokes that have the same width using the width tool? I understand there is the width tool dialog box where you can input values but if the stroke is slightly more twisted than the first stroke and yet I want to keep it uniform how would I go about using the width tool?
    Thanks!

    What's the ideal way to clean up all these anchors?
    The ideal way is to actually draw the shapes you actually want, rather than rely upon automated features. Assuming at least an intermediate-level proficiency, you'll always end up with more elegant and efficient paths. And yes, it will take longer.
    1. simple stroke
    2. width points added ther's only 5 there
    3. stroke expanded, see the tons of anchor points there?
    You are familiar with the ability to turn on/off the display of anchor points with the Show/Hide Edges command, aren't you? Just because the program doesn't display all the actual anchor points involved as you instead manipulate the displayed controls for all these instant-gratification effects (auto-tracing, envelopes, stroke width) doesn't mean they're not there. Like it or not, they're being automatically created as you do those other-interface manipulations.
    Why is it…?
    Because an automated routine cannot read your mind. It doesn't know anything about how many anchorPoints are "ideal" for you to manipulate afterwards, as opposed to how accurately you want it to maintain the same shape it originally automatically generated.
    Do a little research. Read up on how cubic Bezier curves work.  Four Cartesian coordinate pairs (a startPoint, two handles, an endPoint) form a "hull" in which a curve is plotted, live, on any given grid resolution. Each set of four coordinate pairs are one Bezier curve; one segment of your squiggly path.
    Now imagine trying to reverse-engineer that. Start with the particular plotted results on a particular grid (your monitor). Then try to determine from that four coordinate pairs which would yield a curve that would result in that plot. But wait…that's not really what your new demand (for fewer segments) requires: You have to figure out where to break the overall path into fewer segments (fewer sets of just four coordinate pairs). You have to figure out the coordinate pairs for a hull that would plot a curve not for each existing plotted result, but now one set for two segments; or one and a half segments; or three segments….
    Some portions of the reverse-engineering may be relatively easy. Others may actually be impossible.
    In other words, if it were possible to plot any shape you want with just four coordinate pairs, you'd never need multiple-segment paths, would you?
    So after you've studied the math, then make that phone call to the software engineer and explain what he's missing.
    JET

Maybe you are looking for

  • ASK THE EXPERTS:Branch Office Wireless Strategies

    With Jeevan Patil Welcome to the Cisco Support Community Ask the Expert conversation. This is an opportunity to ask how to consolidate your Wireless Branch Network Cisco subject matter expert Jeevan Patil. Mr. Jeevan Patil is a product manager for th

  • Join SolarMetric at the 2005 JavaOne Conference, June 27-30, 2005

    Folks, if you are attending JavaONE, let us know. We'd love to meet up with you in San Francisco. We will be in booth #301 and you can see us at a variety of technical sessions and BOFs: TS-3403 Java Data Objects in Action by SolarMetric's CTO Patric

  • My video dims randomly for no reason - can't reset

    I have an iMac G5 20" second generation... my problem is that my video display will randomly dim for no reason. In my settings, I do not allow it to go to sleep, display is not allowed to go to sleep, under options tab, Automatically reduce the brigh

  • Computer slowing down

    I have tried spyware removal, and very little else. My computer is about 1 year old and it takes forever to load web pages. We have high speed and it used to be really fast. How do I get it back to the way it was? Thanks to anyone who can help.

  • Business Place -  WHT - Invoice posting

    For the vendors subject to EWT , in the invoice posting screen , i.e.FB60 and MIRO - i want to make the fields Business place and Section code as mandatory.-so that one cannot proceed without giving a Busines place. Please let me what the setting I n