pycanha.gmm — Geometric Mathematical Model#

Geometric primitives for defining thermal surface elements.

Primitives#

class pycanha.gmm.Triangle(p1, p2, p3)[source]#

Bases: Triangle

Triangular flat surface defined by three 3D vertices.

Parameters:
  • p1 (npt.ArrayLike)

  • p2 (npt.ArrayLike)

  • p3 (npt.ArrayLike)

is_valid(self) bool#

Whether the primitive geometry is valid.

normal_at_uv(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Outward surface normal at a 2D parametric (uv) point.

property p1#

First vertex.

property p2#

Second vertex.

property p3#

Third vertex.

surface_area(self) float#

Total surface area.

to_cartesian(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Map a 2D parametric (uv) point back to 3D space.

to_uv(self, point: numpy.ndarray[dtype=float64, shape=(3), order='C']) numpy.ndarray[dtype=float64, shape=(2), order='C']#

Project a 3D point onto the primitive’s 2D parametric (uv) space.

class pycanha.gmm.Rectangle(p1, p2, p3)[source]#

Bases: Rectangle

Rectangular flat surface: p1->p2 is one edge, p1->p3 the adjacent edge.

Parameters:
  • p1 (npt.ArrayLike)

  • p2 (npt.ArrayLike)

  • p3 (npt.ArrayLike)

is_valid(self) bool#

Whether the primitive geometry is valid.

normal_at_uv(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Outward surface normal at a 2D parametric (uv) point.

property p1#

Origin vertex.

property p2#

Second vertex (first edge from p1).

property p3#

Third vertex (second edge from p1).

surface_area(self) float#

Total surface area.

to_cartesian(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Map a 2D parametric (uv) point back to 3D space.

to_uv(self, point: numpy.ndarray[dtype=float64, shape=(3), order='C']) numpy.ndarray[dtype=float64, shape=(2), order='C']#

Project a 3D point onto the primitive’s 2D parametric (uv) space.

class pycanha.gmm.Quadrilateral(p1, p2, p3, p4)[source]#

Bases: Quadrilateral

General quadrilateral surface defined by four vertices.

Parameters:
  • p1 (npt.ArrayLike)

  • p2 (npt.ArrayLike)

  • p3 (npt.ArrayLike)

  • p4 (npt.ArrayLike)

is_valid(self) bool#

Whether the primitive geometry is valid.

normal_at_uv(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Outward surface normal at a 2D parametric (uv) point.

property p1#

First vertex.

property p2#

Second vertex.

property p3#

Third vertex.

property p4#

Fourth vertex.

surface_area(self) float#

Total surface area.

to_cartesian(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Map a 2D parametric (uv) point back to 3D space.

to_uv(self, point: numpy.ndarray[dtype=float64, shape=(3), order='C']) numpy.ndarray[dtype=float64, shape=(2), order='C']#

Project a 3D point onto the primitive’s 2D parametric (uv) space.

class pycanha.gmm.Cylinder(p1, p2, p3, radius, start_angle, end_angle)[source]#

Bases: Cylinder

Cylindrical surface segment defined by axis, radius and angular extent.

Parameters:
  • p1 (npt.ArrayLike)

  • p2 (npt.ArrayLike)

  • p3 (npt.ArrayLike)

  • radius (float)

  • start_angle (float)

  • end_angle (float)

property end_angle#

End angle [rad].

is_valid(self) bool#

Whether the primitive geometry is valid.

normal_at_uv(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Outward surface normal at a 2D parametric (uv) point.

property p1#

Base center position.

property p2#

Top center position.

property p3#

Reference point for the angle origin.

property radius#

Cylinder radius.

property start_angle#

Start angle [rad].

surface_area(self) float#

Total surface area.

to_cartesian(self, uv: numpy.ndarray[dtype=float64, shape=(2), order='C']) numpy.ndarray[dtype=float64, shape=(3), order='C']#

Map a 2D parametric (uv) point back to 3D space.

to_uv(self, point: numpy.ndarray[dtype=float64, shape=(3), order='C']) numpy.ndarray[dtype=float64, shape=(2), order='C']#

Project a 3D point onto the primitive’s 2D parametric (uv) space.