clifford.tools.g3c

Tools for 3DCGA (g3c)

3DCGA Tools

Generation Methods

random_bivector()

Creates a random bivector on the form described by R.

standard_point_pair_at_origin()

Creates a standard point pair at the origin

random_point_pair_at_origin()

Creates a random point pair bivector object at the origin

random_point_pair()

Creates a random point pair bivector object

standard_line_at_origin()

Creates a standard line at the origin

random_line_at_origin()

Creates a random line at the origin

random_line()

Creates a random line

random_circle_at_origin()

Creates a random circle at the origin

random_circle()

Creates a random circle

random_sphere_at_origin()

Creates a random sphere at the origin

random_sphere()

Creates a random sphere

random_plane_at_origin()

Creates a random plane at the origin

random_plane()

Creates a random plane

generate_n_clusters(object_generator, …)

Creates n_clusters of random objects

generate_random_object_cluster(n_objects, …)

Creates a cluster of random objects

random_translation_rotor([maximum_translation])

generate a random translation rotor

random_rotation_translation_rotor([…])

generate a random combined rotation and translation rotor

random_conformal_point([l_max])

Creates a random conformal point

generate_dilation_rotor(scale)

Generates a rotor that performs dilation about the origin

generate_translation_rotor(euc_vector_a)

Generates a rotor that translates objects along the euclidean vector euc_vector_a

Geometry Methods

intersect_line_and_plane_to_point(line, plane)

Returns the point at the intersection of a line and plane If there is no intersection it returns None

val_intersect_line_and_plane_to_point

Returns the point at the intersection of a line and plane

quaternion_and_vector_to_rotor(quaternion, …)

Takes in a quaternion and a vector and returns a conformal rotor that implements the transformation

get_center_from_sphere(sphere)

Returns the conformal point at the centre of a sphere by reflecting the point at infinity

get_radius_from_sphere(sphere)

Returns the radius of a sphere

point_pair_to_end_points(T)

Extracts the end points of a point pair bivector

val_point_pair_to_end_points

Extracts the end points of a point pair bivector

get_circle_in_euc(circle)

Extracts all the normal stuff for a circle

circle_to_sphere(C)

returns the sphere for which the input circle is the perimeter

line_to_point_and_direction(line)

converts a line to the conformal nearest point to the origin and a euc direction vector in direction of the line

get_plane_origin_distance(plane)

Get the distance between a given plane and the origin

get_plane_normal(plane)

Get the normal to the plane

get_nearest_plane_point(plane)

Get the nearest point to the origin on the plane

val_convert_2D_polar_line_to_conformal_line(…)

Converts a 2D polar line to a conformal line

convert_2D_polar_line_to_conformal_line(rho, …)

Converts a 2D polar line to a conformal line

val_convert_2D_point_to_conformal

Convert a 2D point to conformal

convert_2D_point_to_conformal(x, y)

Convert a 2D point to conformal

val_distance_point_to_line(point, line)

Returns the euclidean distance between a point and a line

distance_polar_line_to_euc_point_2d(rho, …)

Return the distance between a polar line and a euclidean point in 2D

midpoint_between_lines(L1, L2)

Gets the point that is maximally close to both lines Hadfield and Lasenby AGACSE2018

val_midpoint_between_lines

Gets the point that is maximally close to both lines Hadfield and Lasenby AGACSE2018

midpoint_of_line_cluster(line_cluster)

Gets an approximate center point of a line cluster Hadfield and Lasenby AGACSE2018

val_midpoint_of_line_cluster

Gets an approximate center point of a line cluster Hadfield and Lasenby AGACSE2018

val_midpoint_of_line_cluster_grad

Gets an approximate center point of a line cluster Hadfield and Lasenby AGACSE2018

get_line_intersection(L3, Ldd)

Gets the point of intersection of two orthogonal lines that meet Xdd = Ldd*no*Ldd + no Xddd = L3*Xdd*L3 Pd = 0.5*(Xdd+Xddd) P = -(Pd*ninf*Pd)(1)/(2*(Pd|einf)**2)[0]

val_get_line_intersection

Gets the point of intersection of two orthogonal lines that meet Xdd = Ldd*no*Ldd + no Xddd = L3*Xdd*L3 Pd = 0.5*(Xdd+Xddd) P = -(Pd*ninf*Pd)(1)/(2*(Pd|einf)**2)[0]

project_points_to_plane(point_list, plane)

Takes a load of points and projects them onto a plane

project_points_to_sphere(point_list, sphere)

Takes a load of points and projects them onto a sphere

project_points_to_circle(point_list, circle)

Takes a load of point and projects them onto a circle The closest flag determines if it should be the closest or furthest point on the circle

project_points_to_line(point_list, line)

Takes a load of points and projects them onto a line

Misc

meet_val

The meet algorithm as described in “A Covariant Approach to Geometry” I5*((I5*A) ^ (I5*B))

meet(A, B)

The meet algorithm as described in “A Covariant Approach to Geometry” I5*((I5*A) ^ (I5*B))

normalise_n_minus_1(mv)

Normalises a conformal point so that it has an inner product of -1 with einf

val_normalise_n_minus_1

Normalises a conformal point so that it has an inner product of -1 with einf

val_apply_rotor

Applies rotor to multivector in a fast way - JITTED

apply_rotor(mv_in, rotor)

Applies rotor to multivector in a fast way

val_apply_rotor_inv

Applies rotor to multivector in a fast way takes pre computed adjoint

apply_rotor_inv(mv_in, rotor, rotor_inv)

Applies rotor to multivector in a fast way takes pre computed adjoint

euc_dist(conf_mv_a, conf_mv_b)

Returns the distance between two conformal points

mult_with_ninf

Convenience function for multiplication with ninf

val_norm

Returns sqrt(abs(~A*A))

norm(mv)

Returns sqrt(abs(~A*A))

val_normalised

Returns A/sqrt(abs(~A*A))

normalised(mv)

fast version of the normal() function

val_up

Fast jitted up mapping

fast_up(mv)

Fast up mapping

val_normalInv

A fast, jitted version of normalInv

val_homo

A fast, jitted version of homo()

val_down

A fast, jitted version of down()

fast_down(mv)

A fast version of down()

dual_func

Fast dual

fast_dual(a)

Fast dual

disturb_object(mv_object[, …])

Disturbs an object by a random rotor

project_val

fast grade projection

get_line_reflection_matrix(lines[, n_power])

Generates the matrix that sums the reflection of a point in many lines

val_get_line_reflection_matrix

Generates the matrix that sums the reflection of a point in many lines

val_truncated_get_line_reflection_matrix

Generates the truncated matrix that sums the reflection of a point in many lines n_power should be 1 or a power of 2

interpret_multivector_as_object(mv)

Takes an input multivector and returns what kind of object it is -1 -> not a blade 0 -> a 1 vector but not a point 1 -> a euclidean point 2 -> a conformal point 3 -> a point pair 4 -> a circle 5 -> a line 6 -> a sphere 7 -> a plane

normalise_TR_to_unit_T(TR)

Takes in a TR rotor extracts the R and T normalises the T to unit displacement magnitude rebuilds the TR rotor with the new displacement rotor returns the new TR and the original length of the T rotor

scale_TR_translation(TR, scale)

Takes in a TR rotor and a scale extracts the R and T scales the T displacement magnitude by scale rebuilds the TR rotor with the new displacement rotor returns the new TR rotor

Root Finding

dorst_norm_val

Square Root of Rotors - Implements the norm of a rotor

check_sigma_for_positive_root_val

Square Root of Rotors - Checks for a positive root

check_sigma_for_positive_root(sigma)

Square Root of Rotors - Checks for a positive root

check_sigma_for_negative_root_val

Square Root of Rotors - Checks for a negative root

check_sigma_for_negative_root(sigma)

Square Root of Rotors - Checks for a negative root

check_infinite_roots_val

Square Root of Rotors - Checks for a infinite roots

check_infinite_roots(sigma)

Square Root of Rotors - Checks for a infinite roots

positive_root_val

Square Root of Rotors - Evaluates the positive root Square Root of Rotors - Evaluates the positive root

negative_root_val

Square Root of Rotors - Evaluates the positive root

positive_root(sigma)

Square Root of Rotors - Evaluates the positive root

negative_root(sigma)

Square Root of Rotors - Evaluates the negative root

general_root_val

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

general_root(sigma)

The general case of the root of a grade 0,4 multivector

val_annihilate_k

Removes K from C = KX via (K[0] - K[4])*C

annihilate_k(K, C)

Removes K from C = KX via (K[0] - K[4])*C

pos_twiddle_root_val

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

neg_twiddle_root_val

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

pos_twiddle_root(C)

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

neg_twiddle_root(C)

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

square_roots_of_rotor(R)

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

n_th_rotor_root(R, n)

Takes the n_th root of rotor R n must be a power of 2

interp_objects_root(C1, C2, alpha)

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 Directly linearly interpolates conformal objects Return a valid object from the addition result C

general_object_interpolation(…[, kind])

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 This is a general interpolation through the

average_objects(obj_list[, weights, …])

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 Directly averages conformal objects Return a valid object from the addition result C

val_average_objects_with_weights

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 Directly averages conformal objects Return a valid object from the addition result C

val_average_objects

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 Directly averages conformal objects Return a valid object from the addition result C

rotor_between_objects(X1, X2)

Lasenby and Hadfield AGACSE2018 For any two conformal objects X1 and X2 this returns a rotor that takes X1 to X2 Return a valid object from the addition result 1 + gamma*X2X1

val_rotor_between_objects_root

Lasenby and Hadfield AGACSE2018 For any two conformal objects X1 and X2 this returns a rotor that takes X1 to X2 Uses the square root of rotors for efficiency and numerical stability

val_rotor_between_objects_explicit

Lasenby and Hadfield AGACSE2018 For any two conformal objects X1 and X2 this returns a rotor that takes X1 to X2

calculate_S_over_mu(X1, X2)

Lasenby and Hadfield AGACSE2018 For any two conformal objects X1 and X2 this returns a factor that corrects the X1 + X2 back to a blade

val_rotor_between_lines

Implements a very optimised rotor line to line extraction

rotor_between_lines(L1, L2)

return the rotor between two lines

rotor_between_planes(P1, P2)

return the rotor between two planes

val_rotor_rotor_between_planes

return the rotor between two planes

Functions

TRS_between_rounds(X1, X2)

Calculate the TRS rotor between any pair of rounds of the same grade Bring rounds to origin, line up carriers, calculate scale

annihilate_k(K, C)

Removes K from C = KX via (K[0] - K[4])*C

apply_rotor(mv_in, rotor)

Applies rotor to multivector in a fast way

apply_rotor_inv(mv_in, rotor, rotor_inv)

Applies rotor to multivector in a fast way takes pre computed adjoint

average_objects(obj_list[, weights, …])

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 Directly averages conformal objects Return a valid object from the addition result C

calculate_S_over_mu(X1, X2)

Lasenby and Hadfield AGACSE2018 For any two conformal objects X1 and X2 this returns a factor that corrects the X1 + X2 back to a blade

check_infinite_roots(sigma)

Square Root of Rotors - Checks for a infinite roots

check_sigma_for_negative_root(sigma)

Square Root of Rotors - Checks for a negative root

check_sigma_for_positive_root(sigma)

Square Root of Rotors - Checks for a positive root

circle_to_sphere(C)

returns the sphere for which the input circle is the perimeter

closest_points_circle_line(C, L[, niterations])

Given a circle C and line L this calculates the closest points on each of them to the other

closest_points_on_circles(C1, C2[, niterations])

Given two circles C1 and C2 this calculates the closest points on each of them to the other

convert_2D_point_to_conformal(x, y)

Convert a 2D point to conformal

convert_2D_polar_line_to_conformal_line(rho, …)

Converts a 2D polar line to a conformal line

distance_polar_line_to_euc_point_2d(rho, …)

Return the distance between a polar line and a euclidean point in 2D

disturb_object(mv_object[, …])

Disturbs an object by a random rotor

enclosing_sphere(spheres)

For a given set of spheres this finds a sphere that encloses all of them Tries to find the smallest one it can

euc_dist(conf_mv_a, conf_mv_b)

Returns the distance between two conformal points

fast_down(mv)

A fast version of down()

fast_dual(a)

Fast dual

fast_up(mv)

Fast up mapping

furthest_points_on_circles(C1, C2[, niterations])

Given two circles C1 and C2 this calculates the closest points on each of them to the other

general_object_interpolation(…[, kind])

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 This is a general interpolation through the

general_root(sigma)

The general case of the root of a grade 0,4 multivector

generate_dilation_rotor(scale)

Generates a rotor that performs dilation about the origin

generate_n_clusters(object_generator, …)

Creates n_clusters of random objects

generate_random_object_cluster(n_objects, …)

Creates a cluster of random objects

generate_translation_rotor(euc_vector_a)

Generates a rotor that translates objects along the euclidean vector euc_vector_a

get_center_from_sphere(sphere)

Returns the conformal point at the centre of a sphere by reflecting the point at infinity

get_circle_in_euc(circle)

Extracts all the normal stuff for a circle

get_line_intersection(L3, Ldd)

Gets the point of intersection of two orthogonal lines that meet Xdd = Ldd*no*Ldd + no Xddd = L3*Xdd*L3 Pd = 0.5*(Xdd+Xddd) P = -(Pd*ninf*Pd)(1)/(2*(Pd|einf)**2)[0]

get_line_reflection_matrix(lines[, n_power])

Generates the matrix that sums the reflection of a point in many lines

get_nearest_plane_point(plane)

Get the nearest point to the origin on the plane

get_plane_normal(plane)

Get the normal to the plane

get_plane_origin_distance(plane)

Get the distance between a given plane and the origin

get_radius_from_sphere(sphere)

Returns the radius of a sphere

interp_objects_root(C1, C2, alpha)

Hadfield and Lasenby, Direct Linear Interpolation of Geometric Objects, AGACSE2018 Directly linearly interpolates conformal objects Return a valid object from the addition result C

interpret_multivector_as_object(mv)

Takes an input multivector and returns what kind of object it is -1 -> not a blade 0 -> a 1 vector but not a point 1 -> a euclidean point 2 -> a conformal point 3 -> a point pair 4 -> a circle 5 -> a line 6 -> a sphere 7 -> a plane

intersect_line_and_plane_to_point(line, plane)

Returns the point at the intersection of a line and plane If there is no intersection it returns None

join_spheres(S1in, S2in)

Find the smallest sphere that encloses both spheres

left_gmt_generator()

line_to_point_and_direction(line)

converts a line to the conformal nearest point to the origin and a euc direction vector in direction of the line

meet(A, B)

The meet algorithm as described in “A Covariant Approach to Geometry” I5*((I5*A) ^ (I5*B))

midpoint_between_lines(L1, L2)

Gets the point that is maximally close to both lines Hadfield and Lasenby AGACSE2018

midpoint_of_line_cluster(line_cluster)

Gets an approximate center point of a line cluster Hadfield and Lasenby AGACSE2018

motor_between_objects(X1, X2)

Calculates a motor that takes X1 to X2

motor_between_rounds(X1, X2)

Calculate the motor between any pair of rounds of the same grade Line up the carriers, then line up the centers

n_th_rotor_root(R, n)

Takes the n_th root of rotor R n must be a power of 2

neg_twiddle_root(C)

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

negative_root(sigma)

Square Root of Rotors - Evaluates the negative root

norm(mv)

Returns sqrt(abs(~A*A))

normalise_TR_to_unit_T(TR)

Takes in a TR rotor extracts the R and T normalises the T to unit displacement magnitude rebuilds the TR rotor with the new displacement rotor returns the new TR and the original length of the T rotor

normalise_n_minus_1(mv)

Normalises a conformal point so that it has an inner product of -1 with einf

normalised(mv)

fast version of the normal() function

point_beyond_plane(point, plane)

Check if the point is fully beyond the plane in the direction of the plane normal

point_pair_to_end_points(T)

Extracts the end points of a point pair bivector

pos_twiddle_root(C)

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

positive_root(sigma)

Square Root of Rotors - Evaluates the positive root

project_points_to_circle(point_list, circle)

Takes a load of point and projects them onto a circle The closest flag determines if it should be the closest or furthest point on the circle

project_points_to_line(point_list, line)

Takes a load of points and projects them onto a line

project_points_to_plane(point_list, plane)

Takes a load of points and projects them onto a plane

project_points_to_sphere(point_list, sphere)

Takes a load of points and projects them onto a sphere

quaternion_and_vector_to_rotor(quaternion, …)

Takes in a quaternion and a vector and returns a conformal rotor that implements the transformation

random_bivector()

Creates a random bivector on the form described by R.

random_circle()

Creates a random circle

random_circle_at_origin()

Creates a random circle at the origin

random_conformal_point([l_max])

Creates a random conformal point

random_line()

Creates a random line

random_line_at_origin()

Creates a random line at the origin

random_plane()

Creates a random plane

random_plane_at_origin()

Creates a random plane at the origin

random_point_pair()

Creates a random point pair bivector object

random_point_pair_at_origin()

Creates a random point pair bivector object at the origin

random_rotation_translation_rotor([…])

generate a random combined rotation and translation rotor

random_sphere()

Creates a random sphere

random_sphere_at_origin()

Creates a random sphere at the origin

random_translation_rotor([maximum_translation])

generate a random translation rotor

right_gmt_generator()

rotor_between_lines(L1, L2)

return the rotor between two lines

rotor_between_objects(X1, X2)

Lasenby and Hadfield AGACSE2018 For any two conformal objects X1 and X2 this returns a rotor that takes X1 to X2 Return a valid object from the addition result 1 + gamma*X2X1

rotor_between_planes(P1, P2)

return the rotor between two planes

scale_TR_translation(TR, scale)

Takes in a TR rotor and a scale extracts the R and T scales the T displacement magnitude by scale rebuilds the TR rotor with the new displacement rotor returns the new TR rotor

sphere_behind_plane(sphere, plane)

Check if the sphere is fully behind the plane in the direction of the plane normal, ie the opposite of sphere_beyond_plane

sphere_beyond_plane(sphere, plane)

Check if the sphere is fully beyond the plane in the direction of the plane normal

sphere_in_sphere(S1, S2[, tolerance])

Checks if one sphere is inside the other (S1|S2)[0] < -1

sphere_line_intersect(s, l)

Checks for intersection between a sphere and a line

square_roots_of_rotor(R)

Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg

standard_line_at_origin()

Creates a standard line at the origin

standard_point_pair_at_origin()

Creates a standard point pair at the origin

unsign_sphere(S)

Normalises the sign of a sphere

val_convert_2D_polar_line_to_conformal_line(…)

Converts a 2D polar line to a conformal line

val_distance_point_to_line(point, line)

Returns the euclidean distance between a point and a line

val_unsign_sphere(S)

Normalises the sign of a sphere

Classes

ConformalMVArray

This class is for storing arrays of conformal multivectors