Home | About | Forum | Manual | Download | Screenshots

Point

The point object is a structure used to represent a two-dimensional coordinate or vector. Points can be transformed, scaled or rotated around their origin (0, 0)

    Properties

  • number x
    Horizontal coordinate of the point in pixels. Default value is 0
  • number y
    Vertical coordinate of the point in pixels. Default value is 0

    Constructors

  • Point ( )
    Creates a new point with default x and y coordinates
  • Point ( Point pt )
    Point ( number x, number y )
    Creates a new point from given x and y coordinates

    Constant Methods

  • boolean is_zero ( )
    Returns true if the size is zero
  • boolean is_nonzero ( )
    Returns true if the size is non-zero
  • number size ( )
    Returns the Euclidean distance from the origin, in pixels
  • number size_squared ( )
    Returns the squared Euclidean distance from the origin, in pixels
  • number rotation ( )
    Returns the angle of rotation from the origin, in degrees
  • number rotation_r ( )
    Returns the angle of rotation from the origin, in radians

    Non-Constant Methods

  • add ( Point pt )
    Translates the point by adding it to another
  • assign ( Point pt )
    Assigns new coordinates from another point
  • number direction ( Point pt )
    Returns the direction from one point to another in degrees
  • number direction_r ( Point pt )
    Returns the direction from one point to another in radians
  • number distance ( Point pt )
    Returns the Euclidean distance between two points
  • number distance_squared ( Point pt )
    Returns the squared Euclidean distance between two points
  • divide ( number n )
    Scales the point by dividing its coordinates by a number
  • number dot ( Point pt )
    Returns the dot product of two points
  • multiply ( number n )
    Scales the point by multiplying its coordinates by a number
  • normalize ( )
    Translates the point by setting its size to 1
  • number per ( Point pt )
    Returns the per product of the two points
  • rotate_by ( number degrees_delta )
    Rotates the point by adding delta degrees to the current angle of rotation
  • rotate_by_r ( number radians_delta )
    Rotates the point by adding delta radians to the current angle of rotation
  • rotate_by_180 ( )
    Rotates the point by 180 degrees by negating its x and y coordinates
  • rotate_by_90ccw ( )
    Rotates the point by 90 degrees in counterclockwise direction
  • rotate_by_90cw ( )
    Rotates the point by 90 degrees in clockwise direction
  • set_rotation ( number degrees )
    Rotates the point by setting its rotation to a given angle, in degrees
  • set_rotation_r ( number radians )
    Rotates the point by setting its rotation to a given angle, in radians
  • set_rs ( number rotation, number size )
    Assigns new coordinates from a given rotation and size
  • set_xy ( number x, number y )
    Assigns new coordinates
  • set_size ( number size )
    Translates the point by setting its size to a given distance
  • size_by ( number size_delta )
    Translates the point by adding delta distance to its current size from the origin
  • subtract ( Point pt )
    Translates the point by subtracting another from it
  • truncate ( number size )
    Translates the point by limiting its size to a given number
  • zero ( )
    Sets both of the point's coordinates to 0