clifford.tools.g3c¶

Tools for 3DCGA (g3c)

3DCGA Tools¶

Generation Methods¶

 Creates a random bivector on the form described by R. Creates a standard point pair at the origin Creates a random point pair bivector object at the origin Creates a random point pair bivector object Creates a standard line at the origin Creates a random line at the origin Creates a random line Creates a random circle at the origin Creates a random circle Creates a random sphere at the origin Creates a random sphere Creates a random plane at the origin 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 generate a random combined rotation and translation rotor random_conformal_point([l_max]) Creates a random conformal point 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 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 returns the sphere for which the input circle is the perimeter converts a line to the conformal nearest point to the origin and a euc direction vector in direction of the line Get the distance between a given plane and the origin get_plane_normal(plane) Get the normal to the plane Get the nearest point to the origin on the plane Converts a 2D polar line to a conformal line Converts a 2D polar line to a conformal line val_convert_2D_point_to_conformal Convert a 2D point to conformal Convert a 2D point to conformal val_distance_point_to_line(point, line) Returns the euclidean distance between a point and a line 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)) 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)) fast version of the normal() function val_up Fast jitted up mapping 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() A fast version of down() dual_func Fast dual 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 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 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 Square Root of Rotors - Checks for a positive root check_sigma_for_negative_root_val Square Root of Rotors - Checks for a negative root Square Root of Rotors - Checks for a negative root check_infinite_roots_val Square Root of Rotors - Checks for a infinite roots 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 Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg Square Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg 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 Square Root of Rotors - Checks for a infinite roots Square Root of Rotors - Checks for a negative root Square Root of Rotors - Checks for a positive root 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 a 2D point to conformal Converts a 2D polar line to a conformal line 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 A fast version of down() Fast dual 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 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 the nearest point to the origin on the plane get_plane_normal(plane) Get the normal to the 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 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() 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 Takes the n_th root of rotor R n must be a power of 2 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)) 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 Normalises a conformal point so that it has an inner product of -1 with einf 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 Extracts the end points of a point pair bivector 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 Creates a random bivector on the form described by R. Creates a random circle Creates a random circle at the origin random_conformal_point([l_max]) Creates a random conformal point Creates a random line Creates a random line at the origin Creates a random plane Creates a random plane at the origin Creates a random point pair bivector object Creates a random point pair bivector object at the origin generate a random combined rotation and translation rotor Creates a random sphere 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 Root and Logarithm of Rotors in 3D Conformal Geometric Algebra Using Polar Decomposition Leo Dorst and Robert Valkenburg Creates a standard line at the origin Creates a standard point pair at the origin unsign_sphere(S) Normalises the sign of a sphere 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