Author Topic: Rotating points around a center point in Axe  (Read 4270 times)

0 Members and 1 Guest are viewing this topic.

Offline Nathonion

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Rotating points around a center point in Axe
« on: January 03, 2017, 09:31:42 pm »
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?

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Rotating points around a center point in Axe
« Reply #1 on: January 04, 2017, 12:36:39 pm »
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.