Skip to content

CenterCalculus

Canonical path: NemAll_Python_Geometry.CenterCalculus

Class to calculate the center of an object

Calculate overloaded

Calculate(line: Line2D) -> tuple

Calculates the center of a 2D line

Parameters:

  • line (Line2D) –

    Line2D on which to calculate the center

Returns:

  • tuple

    True when calculation was successful. False otherwise

  • tuple

    Center of the line

Calculate(line: Line3D) -> tuple

Calculates the center of a 3D line

Parameters:

  • line (Line3D) –

    Line3D on which to calculate the center

Returns:

  • tuple

    True when calculation was successful. False otherwise

  • tuple

    Center of the line

Calculate(polyline: Polyline2D, edge: int) -> tuple

Calculates the center of a 2D polyline

Parameters:

  • polyline (Polyline2D) –

    Polyline on which to calculate the center.

  • edge (int) –

    Index of the segment to calculate the center on. Set to 0 to calculate the center of the entire polyline.

Returns:

  • tuple

    True when calculation was successful. False otherwise

  • tuple

    Center of the polyline or its segment

Calculate(polyline: Polyline3D, edge: int) -> tuple

Calculates the center of a 3D polyline

Parameters:

  • polyline (Polyline3D) –

    Polyline on which to calculate the center.

  • edge (int) –

    Index of the segment to calculate the center on. Set to 0 to calculate the center of the entire polyline.

Returns:

  • tuple

    True when calculation was successful. False otherwise

  • tuple

    Center of the polyline or its segment

Calculate(polygon: Polygon2D, bPlaneCenter: bool, edge: int) -> tuple

Calculates the center of a 2D polygon.

Parameters:

  • polygon (Polygon2D) –

    Polygon on which to calculate the center

  • bPlaneCenter (bool) –

    Whether to calculate the center of the area bounded by the polygon (True) or the center of the outline polyline (False)

  • edge (int) –

    When bPlaneCenter is set to False, this is the index of the segment of the outline polyline to calculate the center on. Set to 0 to calculate the center of the entire outline polyline.

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the polygon or its outline

Calculate(polygon: Polygon3D, bPlaneCenter: bool, edge: int) -> tuple

Calculates the center of a 3D polygon.

Parameters:

  • polygon (Polygon3D) –

    Polygon on which to calculate the center

  • bPlaneCenter (bool) –

    Whether to calculate the center of the area bounded by the polygon (True) or the center of the outline polyline (False)

  • edge (int) –

    When bPlaneCenter is set to False, this is the index of the segment of the outline polyline to calculate the center on. Set to 0 to calculate the center of the entire outline polyline.

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the polygon or its outline

Calculate(arc: Arc2D, center: bool) -> tuple

Calculates the center of a 2D arc.

Parameters:

  • arc (Arc2D) –

    arc on which to calculate the center

  • center (bool) –

    Whether to calculate the arc's midpoint, that divides the arc into two halves (True) or the arc's center (False)

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center or midpoint of the arc

Calculate(arc: Arc3D, center: bool) -> tuple

Calculates the center of a 3D arc.

Parameters:

  • arc (Arc3D) –

    arc on which to calculate the center

  • center (bool) –

    Whether to calculate the arc's midpoint, that divides the arc into two halves (True) or the arc's center (False)

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center or midpoint of the arc

Calculate(spline: Spline2D, eps: float) -> tuple

Calculates the center of a 2D spline.

Parameters:

  • spline (Spline2D) –

    Spline on which to calculate the center

  • eps (float) –

    Precision for calculation

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the spline

Calculate(spline: Spline3D, eps: float) -> tuple

Calculates the center of a 3D spline.

Parameters:

  • spline (Spline3D) –

    Spline on which to calculate the center

  • eps (float) –

    Precision for calculation

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the spline

Calculate(spline: BSpline3D, eps: float, bAreaCenter: bool) -> tuple

Calculates the center of a 3D base spline.

Parameters:

  • spline (BSpline3D) –

    B-spline on which to calculate the center

  • eps (float) –

    Precision for calculation

  • bAreaCenter (bool) –

    In case of a closed b-spline: whether to calculate the center of the area bounded by the B-spline (True) or the center of the b-spline curve (False)

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the b-spline

Calculate(spline: BSpline2D, eps: float) -> tuple

Calculates the center of a 2D base spline.

Parameters:

  • spline (BSpline2D) –

    B-spline on which to calculate the center

  • eps (float) –

    Precision for calculation

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the b-spline

Calculate(clothoid: Clothoid2D, eps: float) -> tuple

Calculates the center of a 2D clothoid.

Parameters:

  • clothoid (Clothoid2D) –

    clothoid on which to calculate the center

  • eps (float) –

    Precision for calculation

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the clothoid

Calculate(path: Path2D, eps: float, bAreaCenter: bool) -> tuple

Calculates the center of a 2D path.

Parameters:

  • path (Path2D) –

    Path on which to calculate the center

  • eps (float) –

    Precision for calculation

  • bAreaCenter (bool) –

    In case of a closed path: whether to calculate the center of the area bounded by the path (True) or the center of the path itself (False)

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the path

Calculate(path: Path3D, eps: float, bAreaCenter: bool) -> tuple

Calculates the center of a 3D path.

Parameters:

  • path (Path3D) –

    Path on which to calculate the center

  • eps (float) –

    Precision for calculation

  • bAreaCenter (bool) –

    In case of a closed path: whether to calculate the center of the area bounded by the path (True) or the center of the path itself (False)

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the path

Calculate(geoObject: object, eps: float, bArcCenter: bool, edge: int) -> tuple

Calculates the center of a curve.

Parameters:

  • geoObject (object) –

    object on which to calculate the center

  • eps (float) –

    Precision for calculation

  • bArcCenter (bool) –

    Whether to calculate the arc's midpoint, that divides the arc into two halves (True) or the arc's center (False)

  • edge (int) –

    For polyline and polygon: index of the segment to calculate the center on. Set to 0 to calculate the center of the entire polyline/polygon.

Returns:

  • tuple

    True when calculation was successful. False otherwise.

  • tuple

    Center of the path

Placeholder