No announcement yet.

cartesian coordinate

  • Filter
  • Time
  • Show
Clear All
new posts

    cartesian coordinate


    anybody know how to convert a pc coordinate system(0,0 at top left corner)
    to cartesian coordinate which 0,0 at center and ++ at upper right
    -- at lower left.

    how about some example in gfxtools 2.0?



    Aisin --

    > how about some example in gfxtools 2.0?

    There's no need to perform the conversion yourself... Graphics Tools 2.0 allows the creation of any integer-based coordinate system that you need. See the GfxWorld function in the help file. Also see the sample programs that start with "World" (i.e. world*.bas).

    -- Eric Pearson, Perfect Sync Software

    Perfect Sync Development Tools
    Perfect Sync Web Site
    Contact Us: mailto:[email protected][email protected]</A>

    [This message has been edited by Eric Pearson (edited October 06, 2004).]
    "Not my circus, not my monkeys."


      Here's another way, if you don't have gfxtools. There are still
      easier ways, but this might be useful in more problems other
      than the one you mention

      Emil Menzel

      'Adapted from an Applesoft program
      '(in BASIC Computer programs in science & engineering, by J. H. Gilder,1980)
      'by Emil W. Menzel, Jr
      'Purpose: Convert a Cartesian X,Y from one frame of reference to another
      'Language: almost any BASIC

      'demo (in PB3.5)
      Xno=320: Yno=240 'new origin... of a 640x480 VGA screen
      'NOTE!: old origin is assumed to be 0,0

      DegreesRotation =0

      INPUT "X,Y (on old scale) ",X,Y
      CALL NewCoordinates(Xno, Yno, DegreesRotation, X, Y)
      PRINT X, Y; " (on new scale)"
      'end demo

      SUB NewCoordinates(Xno, Yno, DegreesRotation, X, Y)
      D=DegreesRotation * 3.14159 / 180
      X = (X-Xno) * COS(D) + (Y-Yno) * SIN(D)
      Y = - (X-Xno) * SIN(D) + (Y-Yno) * COS(D)
      END SUB