ladybug_geometry.geometry3d.sphere module

Sphere

class ladybug_geometry.geometry3d.sphere.Sphere(center, radius)[source]

Bases: object

Sphere object.

Parameters:
  • center – A Point3D representing the center of the arc.

  • radius – A number representing the radius of the sphere.

Properties:
  • center

  • radius

  • min

  • max

  • diameter

  • circumference

  • area

  • volume

ToString()[source]

Overwrite .NET ToString.

duplicate()[source]

Get a copy of this object.

classmethod from_dict(data)[source]

Create a Sphere from a dictionary.

Parameters:

data – A python dictionary in the following format

{
    "type": "Sphere"
    "center": (10, 0, 0),
    "radius": 5
}
intersect_line_ray(line_ray)[source]

Get the intersection between this Sphere object and a Ray2D/LineSegment2D.

Parameters:

line_ray – A LineSegment3D or Ray3D that will be extended infinitely for intersection.

Returns:

A LineSegment3D object if a full intersection exists. A Point if a tangent intersection exists. None if no full intersection exists.

intersect_plane(plane)[source]

Get the intersection of a plane with this Sphere object

Parameters:

plane – A Plane object.

Returns:

Arc3D representing a full circle if it exists. None if no full intersection exists.

move(moving_vec)[source]

Get a sphere that has been moved along a vector.

Parameters:

moving_vec – A Vector3D with the direction and distance to move the sphere.

reflect(normal, origin)[source]

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

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

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

rotate(axis, angle, origin)[source]

Rotate this sphere by a certain angle around an axis and origin.

Right hand rule applies: If axis has a positive orientation, rotation will be clockwise. If axis has a negative orientation, rotation will be counterclockwise.

Parameters:
  • axis – A Vector3D axis representing the axis of rotation.

  • angle – An angle for rotation in radians.

  • origin – A Point3D for the origin around which the sphere will be rotated.

rotate_xy(angle, origin)[source]

Get a sphere that is rotated counterclockwise in the world XY plane by an angle.

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

  • origin – A Point3D for the origin around which the sphere will be rotated.

scale(factor, origin=None)[source]

Scale a sphere by a factor from an origin point.

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

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

to_dict()[source]

Get Sphere as a dictionary.

property area

Surface area of sphere

property center

Center of sphere.

property circumference

Circumference of sphere

property diameter

Diameter of sphere

property max

A Point3D for the maximum bounding box vertex around this geometry.

property min

A Point3D for the minimum bounding box vertex around this geometry.

property radius

Radius of sphere.

property volume

Volume of sphere