Geometry¶
- geometry.create_2d_vertex(x: float, y: float)¶
Create a vertex in the x-y plane
- Parameters
x (float) – x-coordinate
y (float) – y-coordinate
- Returns
created vertex
- Return type
- geometry.connect_vertices_straight(vertex1: hypnos.generic_classes.CubitInstance, vertex2: hypnos.generic_classes.CubitInstance) hypnos.generic_classes.CubitInstance¶
Connect 2 vertices with a straight curve
- Parameters
vertex1 (CubitInstance) – vertex to connect
vertex2 (CubitInstance) – vertex to connect
- Returns
Connection curve
- Return type
- geometry.connect_curves_tangentially(vertex1: hypnos.generic_classes.CubitInstance, vertex2: hypnos.generic_classes.CubitInstance) hypnos.generic_classes.CubitInstance¶
Connect 2 curves at the given vertices, with the connection tangent to both curves.
- Parameters
vertex1 (CubitInstance) – vertex to connect from
vertex2 (CubitInstance) – vertex to connect to
- Returns
Connection curve
- Return type
- geometry.make_surface_from_curves(curves_list: list[hypnos.generic_classes.CubitInstance]) hypnos.generic_classes.CubitInstance¶
Make surface from bounding curves
- Parameters
curves_list (list[CubitInstance]) – list of bounding curves
- Returns
Created surface
- Return type
- geometry.make_cylinder_along(radius: float, length: float, axis: str = 'z') hypnos.generic_classes.CubitInstance¶
Make a cylinder along a cartesian axis
- Parameters
radius (float) –
length (float) –
axis (str, optional) – cartesian axis along which to make cylinder, by default “z”
- Returns
created cylinder
- Return type
- geometry.make_loop(vertices: list[hypnos.generic_classes.CubitInstance], tangent_indices: list[int]) list[hypnos.generic_classes.CubitInstance]¶
Connect vertices with straight curves. For specified indices connect with curves tangential to adjacent curves.
- Parameters
vertices (list[CubitInstance]) – vertices to connect
tangent_indices (list[int]) – indices of vertices to start a tangent-connection from, for example to connect the 2nd and 3rd vertices tangentially this would be [1]
- Returns
Curves making up the connected vertices
- Return type
list[CubitInstance]
- geometry.hypotenuse(*sides: float)¶
Take root of sum of squares
- Returns
hypotenuse
- Return type
np.float64 (probably)
- geometry.arctan(opposite: float, adjacent: float)¶
Arctan with range 0, 2pi. Takes triangle side lengths.
- Parameters
opposite (float) – ‘opposite’ side of a right-angled triangle
adjacent (float) – ‘adjacent’ side of a right-angled triangle
- Returns
arctan(opposite/adjacent)
- Return type
float
- geometry.make_surface(vertices: list[geometry.Vertex], tangent_indices: list[int]) hypnos.generic_classes.CubitInstance¶
Make surface from vertices. Curves between specified vertices will be tangential to straight lines at either vertex.
- Parameters
vertices (list[Vertex]) – list of vertices to connect into bounding curves
tangent_indices (list[int]) – indices of vertices to begin a tangent-connection from
- Returns
Connected and bound surface
- Return type
- geometry.blunt_corners(vertices: list[geometry.Vertex], ids: list[int], bluntnesses: list[int]) list¶
Blunt many corners as in blunt_corner simultaneously. Return indices of vertices that have been blunted.
- Parameters
vertices (list[Vertex]) – vertices describing a geometrical outline
ids (list[int]) – indices of vertices to blunt
bluntnesses (list[int]) –
by (corresponding amounts to blunt) –
- Returns
list[Vertex] – list of blunted vertices
list[int] – list of indices of blunted vertices
- class geometry.Vertex(x: int, y=0, z=0)¶
Representation of a vertex. Attributes are 3D coordinates.
- class geometry.Line(slope: geometry.Vertex, const: geometry.Vertex = Vertex(0, 0, 0))¶
Helps with calculations involving points on a line defined by a point + slope