What i need to do then is to rotate the object i select in the same angle but in the opposite direction (it will be the mirror image of the original angle. This lisp is used to get the degrees of object based on 2 points as u can see (setq ANGT (strcat "-" ANGF )) attempting to reverse the angle in order to get a mirror image of the angle (setq ANGF2 (Angtos ANGF1 0 2)) converting to degrees (setq ANGF1 (angle REAL1 REAL2)) extracting angle - in radians (setq ARROW (getpoint "\nPick arrow basepoint")) (setq REAL2 (getpoint "\nSecond point on background")) Real angle point 2 (setq REAL1 (getpoint "\nFirst point on background")) Real angle point 1 (defun C:NA (/ REAL1 REAL2 ARROW ANGF1 ANGF2 ANGT NORTH ) Just cuz you guys are so pro maybe you will have a quick fix In PostScript if you want a relative moveto you use rmoveto.Sup fellas!! Im here calling for your aid again! PostScript's 'moveto' is an absolute moveto, not relative. %matrix currentmatrix 4 2 getinterval aload popĨ 0 0 x % execute 8-level-deep expansion of /O in /V % construct arrays, but to save and reset % from the expansion of /O are not used to % The brackets in the procedure resulting " dup 4 matrix currentmatrix 4 2 getinterval" (else (display x) (display " ") (apply send xs)))) Send is a common utility, turtle-init defines the turtle library in PostScript, the rest of the Scheme turtle library follows, then the sample program that draws two squares. The final version of my Scheme code is shown below. I decided not to worry about returning the current position and orientation to Scheme that's too much work for my current purpose, though it may be useful sometime in the future. I'm afraid that each time I say currentpoint translate I interfere with what you are doing in your setpos command. There are two squares, and the second square is tilted at 45 degrees, but both begin at the center of the page. Neither of the setpos commands is honored. Orientation - get current absolute orientationĪn example that draws two squares is shown below the square command writes four lines of length 50, each followed by a 90 degree right turn: initīut that doesn't work. Pendown - % set global variable is_penup to falseįorward n - if is_penup then 0 n rmoveto currentpoint translateīackward n - if is_penup then 0 n neg rmoveto currentpoint translateĮlse 0 n neg rlineto currentpoint translate Penup - % set global variable is_penup to true My library includes the turtle commands shown below with their PostScript equivalents rotateto and setpos are the definitions you gave previously, is_penup is a global variable initially set to true, and I haven't yet considered pos and orientation, which report the current absolute x y position and orientation of the turtle: init - %! Thanks luser droog, but something is still wrong. I'm trying to figure out how to implement those commands in PostScript. Two of the commands that a turtle recognizes are setpos (which moves to an absolute position) and setorientation (which rotates to an absolute direction). My purpose is to implement a logo-style turtle. In other words, I'm looking for an "absolute moveto" instruction that moves to a specific point, not relative to the current translated coordinates. I also want to know how to move to a specific point on the page after a series of rotations and translations. I want something like "0 rotateto" that leaves me at the current location but pointing to the absolute top of the page similarly, "90 rotateto" would point right. The obvious answer is to keep track of what direction I am pointing each time I translate, but that seems like a lot of work. After doing a complicated series of rotations and translations, I want to return the current direction to "North" pointing at the top of the page.
0 Comments
Leave a Reply. |