Geo rotate coordinates

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

x, y = geo_rotate_coordinates(degrees, radius_x, radius_y)

geo_rotate_coordinates is used to get the x and y coordinates from a circle with a centain radius and angle.

Return value

Argument Type Description
x Number The x coordinate.
y Number The y coordinate.

Arguments

# Argument Type Description
1 degrees Number The number of degrees to calculate with.
2 radius x Number The x radius in pixels. This is the number of pixels from the center of the circle to the horizontal edge.
3 radius y Number This value is optional. The y radius in pixels. This is the number of pixels from the center of the circle to the vertical edge.

Example

-- Calculate the x and y coordinate on 45 degrees with a radius of 200 pixels
myimage1 = img_add("myimage.png", 100, 100, 200, 200)

x, y = geo_rotate_coordinates(45,200)

move(myimage1, x, y, nil, nil)

-- Calculate the x and y coordinate (oval) on 45 degrees with a radius x of 200 pixels and radius y of 100 pixels
myimage2 = img_add("myimage.png", 100, 100, 200, 200)

x, y = geo_rotate_coordinates(45,200,100)

move(myimage2, x, y, nil, nil)