Calculator Community > The Axe Parser Project

Rotating points around a center point in Axe

(1/1)

Nathonion:
So I want to rotate a group of points, and so far I've used this formula:

x′=xcos⁡θ−ysin⁡θ
y′=ycosθ+xsinθ

x′,y′=new rotated coordinates
x,y=old coordinates of point I want to rotate
θ=angle

And I know that in order to rotate around a center point rather than the origin, I need to subtract the center point from the point I want to rotate, do the math, then add it again. But because Axe doesn't have negative numbers, (unless somehow I completely missed that, though I highly doubt that's the case) it instead looping back to the highest number, I think that messes with the math.

How did anyone else do it?

Runer112:
Axe does support signed numbers, in two's complement form. When a value "loops back to the highest number" as you say, it is treated as negative for the purpose of signed operations.

However, Axe doesn't have types attached to values, and many basic operations use unsigned logic because it's simpler/faster. But in most (all?) of these cases, a signed version of the operator exists, usually denoted by repeating the operator. For instance: // for signed division, >> for signed greater than, etc. All of the signed operators can be found in the "Advanced Math" section of the command list.

Also, keep in mind the rather strange range and domain of Axe's sine and cosine functions: a period is 256 units rather than 2𝜋, and the output range is [-127, 127] rather than [-1, 1]. It's also not totally accurate. All of these quirks are because it was designed with the main goal of being quick and dirty.

Navigation

[0] Message Index

Go to full version