ladybug_geometry.geometry2d.arc module

2D Arc

class ladybug_geometry.geometry2d.arc.Arc2D(c, r, a1=0, a2=6.283185307179586)[source]

Bases: object

2D arc object.

Parameters:
  • c – A Point2D representing the center of the arc.

  • r – A number representing the radius of the arc.

  • a1 – A number between 0 and 2 * pi for the start angle of the arc. Note that the direction of the arc is always counterclockwise.

  • a2 – A number between 0 and 2 * pi for the end angle of the arc. Note that the direction of the arc is always counterclockwise.

Properties:
  • c

  • r

  • a1

  • a2

  • p1

  • p2

  • midpoint

  • min

  • max

  • length

  • angle

  • is_circle

  • is_inverted

ToString()[source]

Overwrite .NET ToString.

closest_point(point)[source]

Get the closest Point2D on this object to another Point2D.

Parameters:

point – A Point2D object to which the closest point on this object will be computed.

Returns:

Point2D for the closest point on this line to the input point.

distance_to_point(point)[source]

Get the minimum distance between this object and the input point.

Parameters:

point – A Point2D object to which the minimum distance will be computed.

Returns:

The distance to the input point.

duplicate()[source]

Get a copy of this object.

classmethod from_dict(data)[source]

Create a Arc2D from a dictionary.

Parameters:

data – A python dictionary in the following format

{
    "type": "Arc2D"
    "c": (10, 0),
    "r": 5,
    "a1": 0,
    "a2": 3.14159
}
classmethod from_start_mid_end(p1, m, p2, circle=False)[source]

Initialize a new arc from start, middle, and end points.

Note that input points will be assumed to be in counterclockwise order.

Parameters:
  • p1 – The start point of the arc.

  • m – Any point along the length of the arc that is not the start or end.

  • p2 – The end point of the arc.

  • circle – Set to True if you would like the output to be a full circle defined by the three points instead of an arc with a start and end. Default is False.

intersect_line_infinite(line_ray)[source]

Get the intersection between this Arc2D and an infinitely extending Ray2D.

Parameters:

line_ray – Another LineSegment2D or Ray2D or to intersect.

Returns:

A list of 2 Point2D objects if a full intersection exists. A list with a single Point2D object if the line is tangent or intersects only once. None if no intersection exists.

intersect_line_ray(line_ray)[source]

Get the intersection between this Arc2D and another Ray2 or LineSegment2D.

Parameters:

line_ray – Another LineSegment2D or Ray2D or to intersect.

Returns:

A list of 2 Point2D objects if a full intersection exists. A list with a single Point2D object if the line is tangent or intersects only once. None if no intersection exists.

move(moving_vec)[source]

Get an arc that has been moved along a vector.

Parameters:

moving_vec – A Vector2D with the direction and distance to move the arc.

point_at(parameter)[source]

Get a point at a given fraction along the arc.

Parameters:

parameter – The fraction between the start and end point where the desired point lies. For example, 0.5 will yield the midpoint.

point_at_angle(angle)[source]

Get a point at a given angle along the arc.

Parameters:

angle – The angle in radians from the start point along the arc to get the Point2D.

point_at_length(length)[source]

Get a point at a given distance along the arc segment.

Parameters:

length – The distance along the arc from the start point where the desired point lies.

reflect(normal, origin)[source]

Get a arc reflected across a plane with the input normal vector and origin.

Parameters:
  • normal – A Vector2D representing the normal vector for the plane across which the arc will be reflected. THIS VECTOR MUST BE NORMALIZED.

  • origin – A Point2D representing the origin from which to reflect.

rotate(angle, origin)[source]

Get a arc that is rotated counterclockwise by a certain angle.

Parameters:
  • angle – An angle for rotation in radians.

  • origin – A Point2D for the origin around which the arc will be rotated.

scale(factor, origin=None)[source]

Scale a arc by a factor from an origin point.

Parameters:
  • factor – A number representing how much the arc should be scaled.

  • origin – A Point2D representing the origin from which to scale. If None, it will be scaled from the World origin (0, 0).

split_line_infinite(line_ray)[source]

Split this Arc2D in 2-3 using an infinitely extending Ray2D or LineSegment2D.

Parameters:

line_ray – A LineSegment2D or Ray2D that will be extended infinitely for intersection.

Returns:

A list with 2 or 3 Arc2D objects if the split was successful. Will be a list with 1 Arc2D if no intersection exists.

subdivide(distances)[source]

Get Point2D values along the arc that subdivide it based on input distances.

Parameters:

distances – A list of distances along the arc at which to subdivide it. This can also be a single number that will be repeated until the end of the arc.

subdivide_evenly(number)[source]

Get Point2D values along the arc that divide it into evenly-spaced segments.

Parameters:

number – The number of segments into which the arc will be divided.

to_dict()[source]

Get Arc2D as a dictionary.

to_polyline(divisions, interpolated=True)[source]

Get this Arc2D as an approximated Polyline2D.

Parameters:
  • divisions – The number of segments into which the arc will be divided.

  • interpolated – Boolean to note whether the polyline should be interpolated between the input vertices when it is translated to other interfaces. This property has no effect on the geometric calculations performed by this library and is only present in order to assist with display/translation. (Default: True)

property a1

Start angle of the arc in radians.

property a2

End angle of the arc in radians.

property angle

The total angle over the domain of the arc in radians.

property area

Area of the circle to which the arc belongs.

property c

Center point of the circle on which the arc lies.

property is_circle

Boolean for whether the arc is a full circle (True) or not (False).

property is_inverted

Boolean noting whether the end angle a2 is smaller than the start angle a1.

property length

The length of the arc.

property max

A Point2D for the maximum bounding rectangle vertex around this geometry.

property midpoint

Midpoint.

property min

A Point2D for the minimum bounding rectangle vertex around this geometry.

property p1

Start point.

property p2

End point.

property r

Radius of arc.