coords#

A structured collection of 3D coordinates.

The coords module defines the Coords class, which is the basic data structure in HelloTriangle to store the coordinates of points in a 3D space.

This module implements a data class for storing large sets of 3D coordinates and provides an extensive set of methods for transforming these coordinates. Most of HelloTriangle’s classes which represent geometry (e.g. Mesh, use a Coords object to store their coordinates.

While the user will mostly use the higher level classes, there might occasionally be a good reason to use the Coords class directly as well.

Constructor#

Coords

A structured collection of points in a 3D cartesian space.

Property methods#

Coords.xyz

Return the coordinates of the points as a NumPy ndarray.

Coords.x

Return the X-coordinates of all points.

Coords.y

Returns the Y-coordinates of all points.

Coords.z

Returns the Z-coordinates of all points.

Coords.xy

Return the X- and Y-coordinates of all points.

Coords.yz

Return the Y- and Z-coordinates of all points.

Coords.xz

Return the X- and Z-coordinates of all points.

Coords information#

Coords.points_shape

Return the points shape of the Coords object.

Coords.n_points

Return the total number of points in the Coords.

Coords.n_coords

Return the total number of points in the Coords.

Coords.bounding_box

Return the bounding box of a set of points.

Coords.bounding_box_point

Return a bounding box point of a Coords.

Coords.bounding_box_points

Return all the corners of the bounding box of a Coords.

Coords.bounding_boxes

Return the bounding boxes of all subsets of points in the Coords.

Coords.center

Return the center of the Coords.

Coords.average

Returns a (weighted) average of the Coords.

Coords.centroid

Return the centroid of the Coords.

Coords.sizes

Return the bounding box sizes of the Coords.

Coords.max_size

Return the maximum size of a Coords in any coordinate direction.

Coords.diag_size

Return the diagonal size of the bounding box of the Coords.

Coords.bounding_sphere

Return the radius of the bounding sphere of the Coords.

Coords.central_coordsys

Returns the central coordinate system of the Coords.

Coords.directional_size

Returns the extreme distances from the plane p,n.

Coords.directional_extremes

Returns extremal planes in the direction n.

Coords.directional_width

Returns the width of a Coords in the given direction.

Affine transformations#

Coords.scale

Return a scaled copy of the Coords object.

Coords.resized

Return a copy of the Coords object scaled to a target size.

Coords.translate

Return a translated copy of the Coords object.

Coords.centered

Return a centered copy of the Coords.

Coords.align

Align a Coords object on a given point.

Coords.rotate

Return a copy rotated over angle around axis.

Coords.rotate_x

Return a copy rotated over angle around the X-axis.

Coords.rotate_y

Return a copy rotated over angle around the Y-axis.

Coords.rotate_z

Return a copy rotated over angle around the Z-axis.

Coords.shear

Return a copy skewed in the direction of a global axis.

Coords.reflect

Reflect the coordinates across a mirror plane.

Coords.affine

Perform a general affine transformation.

Coords.to_coordsys

Express the coordinates in another coordinate system.

Coords.from_coordsys

Transform the coordinates from another CoordSys to global axes.

Coords.transform_coordsys

Perform a coordinate system transformation on the Coords.

Coords.position

Position a Coords so that 3 points x are aligned with y.

Non-affine transformations#

Coords.cylindrical_to_cartesian

Convert from cylindrical to cartesian coordinates.

Coords.hyper_cylindrical

Convert cylindrical coordinates to Cartesian with advanced, angle-dependent scaling.

Coords.cartesian_to_cylindrical

Converts from cartesian to cylindrical coordinates.

Coords.spherical_to_cartesian

Convert from spherical to cartesian coordinates.

Coords.super_spherical

Perform a superspherical transformation.

Coords.cartesian_to_spherical

Converts from cartesian to spherical coordinates.

Coords.spiral

Perform a spiral transformation.

Coords.circulize

Transform sectors of a regular polygon into circular sectors.

Coords.bump

Create a 1-, 2-, or 3-dimensional bump in a Coords.

Coords.flare

Create a flare at the end of a Coords block.

Coords.map

Map a Coords by a 3-D function.

Coords.add_noise

Add random noise to a Coords.

Coords generation#

Coords.append

Append more coords to a Coords object.

Coords.concatenate

Concatenate a list of Coords objects.

Coords.replicate

Replicate a Coords n times with a fixed translation step.

Coords.rosette

Create rotational replications of a Coords.

Coords.interpolate

Create linear interpolations between two Coords.

Coords.fromstring

Create a Coords object with data from a string.

Distance#

Coords.distance_to_point

Returns the distance of all points to the point p.

Coords.distance_to_line

Returns the distance of all points to the line (p,n).

Coords.distance_to_plane

Return the distance of all points from the plane (p,n).

Projection#

Coords.project_on_plane

Project a Coords on a plane.

Coords.project_on_sphere

Project a Coords on a sphere.

Coords.project_on_cylinder

Project the Coords on a cylinder with axis parallel to a global axis.

Coords.project_on_surface

Project a Coords on a triangulated surface.

Inertia#

Coords.inertia

Return inertia related quantities of the Coords.

Coords.principal_coordsys

Return a CoordSys formed by the principal axes of inertia.

Coords.principal_sizes

Return the sizes in the principal directions of the Coords.

Coords.dimensions

Return the dimensionality of the Coords cloud.

Axes manipulation#

Coords.copy_axes

Copy the coordinates along the axes j to the axes i.

Coords.permute_axes

Permute the coordinate axes.

Coords.swap_axes

Swap two coordinate axes.

Coords.roll_axes

Roll the coordinate axes over the given amount.

Other#

Coords.set

Set the coordinates from those in the given array.

Coords.to_string

Return a string with the formatted points of a Coords object.

Coords.points

Return the Coords object as a flat set of points.

Coords.closest_to_point

Returns the point closest to a given point p.

Coords.test

Flag points having coordinates between min and max.

Coords.sort

Sort points in the specified order of their coordinates.

Coords.boxes

Create a grid of equally sized boxes spanning the Coords.

Coords.fuse

Find (almost) coinciding points and return a compressed set.

Coords.unique

Returns the unique points after fusing.

Coords.adjust

Find (almost) identical nodes and adjust them to be identical.

Coords.match

Match points in another Coords object.

Coords.has_match

Find out which points are also in another Coords object.