Geometry

class vSCAD.Geometry.geometry.Distortions[source]

Bases: object

add_path_noise(noise_level=0.1, noise_type='x', hold=3)[source]

Adds noise to the path of the vessel.

Parameters:
  • vessel (Vessel) – Vessel object.

  • noise_level (float, optional) – The level of noise to add to the path (default is 0.1).

  • noise_type (str, optional) – The type of noise to add: ‘x’, ‘y’, ‘z’, ‘xy’, ‘xz’, ‘yz’, or ‘all’ (default is ‘x’).

  • hold (int, optional) – Number of points at each end to hold fixed (default is 3).

Return type:

None

class vSCAD.Geometry.geometry.GeometricFunctions[source]

Bases: object

direction_to_euler(normal=None)[source]

Converts a direction vector to Euler angles.

Parameters:
  • direction (array-like) – The direction vector to convert.

  • normal (array-like, optional) – The normal vector of the plane to convert the direction vector to Euler angles, default is [0, 0, 1].

Returns:

euler_angles – Euler angles in degrees (ZYX rotation).

Return type:

ndarray

get_direction_vector(point2)[source]

Calculates the tangent vector between two points.

Parameters:
  • point1 (array-like) – First point.

  • point2 (array-like) – Second point.

Returns:

tangent_vector – The normalized tangent vector between the two points.

Return type:

ndarray

get_endpoints_normal(cross=None)[source]

Calculates the vector normal to the line between the first and last points of the vessel.

Parameters:
  • vessel (Vessel) – Vessel object.

  • cross (array-like, optional) – Vector to cross with, default is None.

Returns:

normal – Normalized normal vector.

Return type:

ndarray

interpolate_coordinates_3d(n)[source]

Interpolates a list of points using cubic spline interpolation.

Parameters:
  • points (array-like) – List of points (3D), formatted as a list of lists.

  • n (int) – The number of additional points to add between original point pairs.

Returns:

interpolated_points – A list of newly interpolated points.

Return type:

ndarray

interpolate_scalar(n)[source]

Interpolates a list of points using cubic spline interpolation.

Parameters:
  • scalar_data (array-like) – List of scalar values.

  • n (int) – The number of additional points to add between original point pairs.

Returns:

interpolated_scalar – A list of newly interpolated scalars.

Return type:

ndarray

class vSCAD.Geometry.geometry.Vessel(name='vessel')[source]

Bases: object

get_direction_vectors()[source]

Determine the direction vectors between each point in the path.

Return type:

None

get_euler_angles()[source]

Determine the Euler angles between each point in the path.

Return type:

None

interpolate_paths(n)[source]

Interpolates the path and diameters of the vessel using cubic spline interpolation.

Parameters:

n (int) – The number of additional points to add between original point pairs.

set_diameters(diams)[source]

Sets the diameters of the vessel as a list of diameters.

Parameters:

diams (array-like) – List or array of diameters.

set_path(path)[source]

Sets the path of the vessel as a list of points.

Parameters:

path (array-like) – List or array of points representing the vessel path.

set_scale_factor(scale_factor)[source]

Sets the scale factor for the vessel.

Parameters:

scale_factor (float) – Scale factor to apply to the vessel.