Draw Arc Problem

Imperial

Member
Hello

I'm trying to use this script to draw a simple arc https://www.gmlscripts.com/script/draw_arc

I understand that the first two points (x1,y1 and x2,y2) are the size of the bounding box to draw the arc on

the only thing I didn't get is the last two points (x3,y3 and x4,y4)

I'm aware there is a description on the top of the script, but it wasn't clear for me

thank you for your time
 
Last edited:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
(x3, y3) and (x4, y4) are positions in the room from which an imaginary line will be drawn to the center of the area defined by (x1, y1) and (x2, y2). These imaginary lines will bisect the arc ellipse that is within the rectangular area and so define the size of the arc from that ellipse. Here's a quick illustration:

1623917210940.png
 

Imperial

Member
If thats the case why I get a wrong shape if I try to draw 25% circle for example ?

GML:
var width = 256;
var height = 256;
var xx = (global.display_width/2) - (width/2);
var yy = (global.display_height/2) - (height/2);
draw_set_color(c_white);
draw_rectangle(xx,yy,xx+width,yy+height,1);
draw_arc(xx,yy,xx+width,yy+height,xx,yy-height,xx+width,yy,0,0);


this is the shape I'm aiming for (drawn in Inkscape)

 

Nidoking

Member
Because the shape you've drawn isn't the one you put in that call to draw_arc. Have another look at the diagram and imagine where your x3, y3 would be for a vertical segment. Directly above the center of the box, right? You've placed yours above the top-left corner. You'll either have to move the corners of the box so that xx, yy is the center, or move your third and fourth points to be at the correct directions from the center.
 
Top