Arc

Element

An arc is a partial circumference line of a circle. It is defined by a center, one point that defines the radius, and a third point that defines the angle of the arc.

As a curve the arc has curve length 6.

Usage (signatures)
board.create('arc', [center, p1, p2]);

Draw a circle arc around center through p1. The arc is drawn counter-clockwise from p1 to p2.

Parameters
Name Type Description
center PointLike
p1 PointLike
p2 PointLike
Examples
// Create an arc out of three free points
var p1 = board.create('point', [2.0, 2.0]);
var p2 = board.create('point', [1.0, 0.5]);
var p3 = board.create('point', [3.5, 1.0]);

var a = board.create('arc', [p1, p2, p3]);
board.create('text',[1,6,function(){return 'arclength: '+Math.round(a.Value()*100)/100}])
var t = board.create('transform', [2, 1.5], {type: 'scale'});
var a1 = board.create('arc', [[1, 1], [0, 1], [1, 0]], {strokeColor: 'red'});
var a2 = board.create('curve', [a1, t], {strokeColor: 'red'});

Attributes

Own

anglePoint

Description

Attributes for angle point.

Type
Point
Default Value
{}
Source
options.js, line 4230

center

Description

Attributes for center point.

Type
Point
Default Value
{}
Source
options.js, line 4208

hasInnerPoints

Description

If true, moving the mouse over inner points triggers hasPoint.

Type
Boolean
Default Value
false
See
Source
options.js, line 4169

orientation

Description

Orientation of the arc: 'clockwise' or 'counterclockwise' (default).

If the attribute 'selection' is set to 'minor' or 'major' and "the other" arc is to be taken, the orientation of the arc switches, too.

Type
String
Default Value
'counterclockwise'
Example
var p1, p2, p3, a;
p1 = board.create('point', [0, 0]);
p2 = board.create('point', [4, 0]);
p3 = board.create('point', [3, 3]);
board.create('arc', [p1, p2, p3], {
    dash: 3,
    name: 'a',
    withLabel: true,
    strokeColor: 'black',
    strokeWidth: 3,
    orientation: 'clockwise',
    lastArrow: true
});

Source
options.js, line 4117

radiusPoint

Description

Attributes for radius point.

Type
Point
Default Value
{}
Source
options.js, line 4219

selection

Description

Type of arc. Possible values are 'minor', 'major', and 'auto'.

Type
String
Default Value
'auto'
Source
options.js, line 4107

useDirection

Description

If true, there is a fourth parent point, i.e. the parents are [center, p1, p2, p3]. p1 is still the radius point, p2 the angle point. The arc will be that part of the the circle with center 'center' which starts at p1, ends at the ray between center and p2, and passes p3.

This attribute is immutable (by purpose). This attribute is necessary for circumCircleArcs

Type
Boolean
Default Value
false
Source
options.js, line 4191

useDirection

Description

If true, there is a fourth parent point, i.e. the parents are [center, p1, p2, p3]. p1 is still the radius point, p2 the angle point. The sector will be that part of the the circle with center 'center' which starts at p1, ends at the ray between center and p2, and passes p3.

This attribute is immutable (by purpose). This attribute is necessary for circumCircleSectors

Type
Boolean
Default Value
false
Source
options.js, line 8612

Inherited

none

Members

Own

L

Description

Arc length.

See
Source
element/arc.js, line 313

anglepoint : JXG.Point

Description

The point defining the arc's angle.

Type
JXG.Point
Source
element/arc.js, line 159

center : JXG.Point

Description

Center of the arc.

Type
JXG.Point
Source
element/arc.js, line 142

radiuspoint : JXG.Point

Description

Point defining the arc's radius.

Type
JXG.Point
Source
element/arc.js, line 150

Inherited

none

Methods

Own

Radius() → {Number}

Determines the arc's current radius. I.e. the distance between Arc#center and Arc#radiuspoint.

Returns

The arc's radius

Type
Number

Details

Source
element/arc.js, line 245

Value(unitopt, radopt) → {Number}

Returns the length of the arc or the value of the angle spanned by the arc.

Parameters

Name Type Attributes Default Description
unit String <optional>
'length'

Unit of the returned values. Possible units are

  • 'length' (default): length of the arc line
  • 'radians': angle spanned by the arc in radians
  • 'degrees': angle spanned by the arc in degrees
  • 'semicircle': angle spanned by the arc in radians as a multiple of π, e.g. if the angle is 1.5π, 1.5 will be returned.
  • 'circle': angle spanned by the arc in radians as a multiple of 2π

It is sufficient to supply the first three characters of the unit, e.g. 'len'.

rad Number <optional>

Value of angle which can be used instead of the generic one.

Returns

The arc length or the angle value in various units.

Type
Number

Details

Source
element/arc.js, line 268

getRadius() → {Number}

Returns

Type
Number

Details

Deprecated
Use Arc#Radius
Source
element/arc.js, line 256

hasPointSector(x, y) → {Boolean}

Checks whether (x,y) is within the sector defined by the arc.

Parameters

Name Type Description
x Number

Coordinate in x direction, screen coordinates.

y Number

Coordinate in y direction, screen coordinates.

Returns

True if (x,y) is within the sector defined by the arc, False otherwise.

Type
Boolean

Details

Source
element/arc.js, line 371

Inherited

none

Throws

If the element cannot be constructed with the given parent objects an exception is thrown.

Type
Error

Details

Type
JXG.Curve
Source
element/arc.js, line 48