Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Triangular Geometry?

Comments in 'Plugin Development' started by PEMapModder, Apr 1, 2015.

  1. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I'm planning to work on a game plugin (kind of like board game) whose board is, rather than traditional rectangular coordinates like chess, triangular coordinates instead. What I mean is, the board is a plane filled with triangles, and pieces only move on the lines like how the castle in chess only moves along the drawn lines.
    Rendering them in a map would not be very difficult as only essential trigonometry is required.
    But I'd like to ask, what's the most effective coordinate system to record, and therefore measure, the things on the board? In rectangular geometry we use X-Y system to measure, and it is very effective to record (only two numbers needed) and measure (direct subtraction or some Pythagoras's theorem involved). What about triangles? (I only need integers in this case)

    My board is basically a hexagon.

    I was thinking of using two vectors, respectively 0, π/3 radians (anti-clockwise), to use as the vectors. Here I name them axes X and Ω. This means, from the origin, travel along the X-axis for x units, then along the Ω-axis for Ω units. Since the pieces only move along the triangular lines directly, they only move in these six motions:
    • X+ (0 rad)
    • X- (π rad)
    • Ω+ (π/3 rad)
    • Ω- (4π/3 rad)
    • X-, Ω+ (2π/3 rad)
    • X+, Ω- (5π/3 rad)
    Though, the 2π/3 and 5π/3 vector calculations seem to be a bit inconvenient. Can anyone think of or suggest a better system?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Oh and I just thought of polar coordinates. But I don't know how convenient it could be to move 1 unit in 0° direction from a coordinate called (3, 120°).
  3. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    It would be helpful if you can draw a picture of what you are trying to achieve. What kind of triangles are you thinking of using? If you are using half squares, then you can still use cartesian (X/Y) geometry.
    PEMapModder and iJoshuaHD like this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Equilateral triangles.
    triangular coordinates.PNG
  5. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    In that configuration you could still use cartesian X-Y coordinates... So while you display it like you shown, if you "internally" change the angles to 45 and 90... they you end up with a straight grid. So your AI and your logic could be simplified...
    PEMapModder likes this.

Share This Page

Advertisement