Curve Renderers

This page documents library functions that render curves, such as circles and ellipses.

Circle

dcircle(pcentre,r,x,y)d_ ext{circle} left(, p_ ext{centre}, r, x, y , ight)

Generate a circle at centre pcentrep_\text{centre} with radius rr.

Arguments

ArgumentDescriptionDomainConstraintsNotes
pcentrep_\text{centre}centre(R,R)(\mathbb{R}, \mathbb{R})
rrradiusR+\mathbb{R}^{+}
xxcalculator xx
yycalculator yy

Return

ValueDescriptionCodomainConstraintsNotes
ω\omegaprojectionR\mathbb{R}

Usage

Circles cannot be rendered by a function – an expression is needed. Compare the output of the renderer to 00 using an inequality to render the circle.

d_{circle}left(p_{centre}, r, x, y\right)=left(x-p_{centre}.x\right)^{2}+left(y-p_{centre}.y\right)^{2}-r^{2}
d_{circle}left(left(2, 2\right), 1, x, y\right)le0
d_{circle}left(left(5, 5\right), 10, x, y\right)ge0

Implementation

dcircle(pcentre,r,x,y)=(xpcentre.x)2+(ypcentre.y)2r2d_ ext{circle} left(, p_ ext{centre}, r, x, y , ight) = left(x-p_{centre}.x ight)^{2}+left(y-p_{centre}.y ight)^{2}-r^{2}

For all points (x,y)(x, y) in the 2D plane, the renderer evaluates the formula of a circle with (x,y)(x, y) substituted in. Using an inequality renders the locus of points that form the circle.

Dependencies

None

Ellipse

dellipse(pcentre,pradii,x,y)d_ ext{ellipse} left(, p_ ext{centre}, p_ ext{radii}, x, y , ight)

Generate an ellipse at centre centre pcentrep_\text{centre} with radii pradiip_\text{radii}.

Arguments

ArgumentDescriptionDomainConstraintsNotes
pcentrep_\text{centre}(R,R)(\mathbb{R}, \mathbb{R})
pradiip_\text{radii}(R+,R+)(\mathbb{R}^{+}, \mathbb{R}^{+})
xxcalculator xx
yycalculator yy

Return

ValueDescriptionCodomainConstraintsNotes
ω\omegaprojectionR\mathbb{R}

Usage

Circles cannot be rendered by a function – an expression is needed. Compare the output of the renderer to 00 using an inequality to render the circle.

d_{ellipse}left(p_{centre}, p_{radii}, x, y\right)=left(rac{x-p_{centre}.x}{p_{radii}.x/p_{radii}.y}\right)^{2}+left(y-p_{centre}.y\right)^{2}-p_{radii}.y^{2}
d_{ellipse}left(left(0, 0\right), R, x, y\right)le0
R=left(X, Y\right)
X=3
Y=2

Implementation

dellipse(pcentre,pradii,x,y)=(xpcentre.xpradii.x/pradii.y)2+(ypcentre.y)2pradii.y2d_ ext{ellipse} left(, p_ ext{centre}, p_ ext{radii}, x, y , ight) = left( rac{x-p_{centre}.x}{p_{radii}.x/p_{radii}.y} ight)^{2}+left(y-p_{centre}.y ight)^{2}-p_{radii}.y^{2}

Essentially, we’re drawing a circle with radius pradii.yp_\text{radii}.y, then scaling it by the ratio pradii.x/pradii.yp_\text{radii}.x / p_\text{radii}.y to form the ellipse.

Dependencies

None