dcrg.geom

Subpackages

Classes

dcrg.geom.IntersectType

class dcrg.geom.IntersectType

Bases: int8

Functions

dcrg.geom.Rodrigues

dcrg.geom.Rodrigues(omega)

RODRIGUES Reurns the rotation matix assiated with the vector omega omega is a vector whos direction refines the axis of rotation and who magnitude defines the magnitude of rotation (in radians)

dcrg.geom.affineFit

dcrg.geom.affineFit(X)

Computes the plane that fits best (lest square of the normal distance to the plane) a set of sample points. INPUTS:

X: a N by 3 matrix where each line is a sample point

OUTPUTS:

n : a unit (column) vector normal to the plane V : a 3 by 2 matrix. The columns of V form an orthonormal basis of the plane p : a point belonging to the plane

NB: this code actually works in any dimension (2,3,4,…) Author: Adrien Leygue Date: August 30 2013

dcrg.geom.mirror

dcrg.geom.mirror(n)

matrix to mirror points about plane with normal n

dcrg.geom.norm

dcrg.geom.norm(v)

dcrg.geom.plane_line_intersect

dcrg.geom.plane_line_intersect(n, V0, P0, P1)

plane_line_intersect computes the intersection of a plane and a segment(or a straight line)

Inputs:

n: normal vector of the Plane V0: any point that belongs to the Plane P0: end point 1 of the segment P0P1 P1: end point 2 of the segment P0P1

Outputs:

I is the point of interection

Check is an indicator:

0 => disjoint (no intersection) 1 => the plane intersects P0P1 in the unique point I 2 => the segment lies in the plane 3=>the intersection lies outside the segment P0P1

Example: Determine the intersection of following the plane x+y+z+3=0 with the segment P0P1: The plane is represented by the normal vector n=[1 1 1] and an arbitrary point that lies on the plane, ex: V0=[1 1 -5] The segment is represented by the following two points P0=[-5 1 -1]

P1=[1 2 3]

[I,check]=plane_line_intersect([1 1 1],[1 1 -5],[-5 1 -1],[1 2 3]);

This function is written by :

Nassim Khaled Wayne State University Research Assistant and Phd candidate

If you have any comments or face any problems, please feel free to leave your comments and i will try to reply to you as fast as possible.

dcrg.geom.rotateAbout

dcrg.geom.rotateAbout(a, b, theta)

Rotate vector a about vector b by theta radians. Thanks user MNKY at http://math.stackexchange.com/a/1432182/81266