Package schrodinger :: Package application :: Package matsci :: Module shapes :: Class ConvexPolyhedron
[hide private]
[frames] | no frames]

Class ConvexPolyhedron

object --+
         |
        ConvexPolyhedron
Known Subclasses:

Class to manage a convex polyhedron.

Instance Methods [hide private]
 
__init__(self, params, center, ref_face_idx, ref_face_normal_along, ref_edge_idx, ref_edge_along)
Create an instance.
 
updateShape(self, vertices)
Update the shape object using the provided vertices.
list
getVertices(self, vertices, scale=1.0)
Create vertex data for the polyhedron, including an option to scale all vertices using a multiplicative factor.
list
getFaces(self, vertices, all_indices, num_unique)
Create face data for the polyhedron.
 
translateVertices(self, vertices, vector)
Translate the vertices by adding the specified vector.
float
getSurfaceArea(self, faces)
Return the surface area of the polyhedron.
list
getReferenceFaces(self, faces, num_unique)
Return a list containing the num_unique number of unique faces.
list
alignPolyhedron(self, vertices, face_vector, face_along, edge_vector, edge_along)
Return the polyhedron vertices rotated so as to align the face and edge vectors.
schrodinger.structure.Structure
makeTemplate(self)
Create a template, i.e.
 
addPointsToTemplate(self, points)
Add the specified points to this convex polyhedron's template.
 
addAlignmentAxesToTemplate(self)
Add unit vectors that mark the primary and secondary alignment axes to the template.
 
addNormalsToTemplate(self)
Add the normals of this convex polyhedron to its template.
two lists of numpy.array
getSegmentPlaneIntersections(self, line_start, line_end)
Return a two lists (1) of points where the given line segment intersects the planes containing this polyhedron's faces and (2) the centers of the faces whose planes are being intersected.
 
addSegmentPlaneIntersectionsToTemplate(self, line_start, line_end)
Add to this polyhedron's template the intersection points of the specified line segment and the planes containing the faces.
bool
pointInside(self, point)
Return True if the query point is either on or inside of this convex polyhedron.
bool
allFacesIntersected(self)
Return True if all faces, not the planes containing those faces but the actual faces, of this convex polyhedron have been intersected at least once given all pointInside queries performed thus far.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, params, center, ref_face_idx, ref_face_normal_along, ref_edge_idx, ref_edge_along)
(Constructor)

 

Create an instance.

Parameters:
  • params (list) - list of floating point parameters defining the polyhedron
  • center (numpy.array) - the center of the polyhedron
  • ref_face_idx (int) - specifies which of this polyhedron's available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment
  • ref_face_normal_along (numpy.array triple) - specifies the vector along which the reference face normal will be aligned
  • ref_edge_idx (int) - specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment
  • ref_edge_along (numpy.array triple) - specifies the vector along which the reference edge will be aligned
Overrides: object.__init__

updateShape(self, vertices)

 

Update the shape object using the provided vertices.

Parameters:
  • vertices (list) - list of Vertex with new coordinates

getVertices(self, vertices, scale=1.0)

 

Create vertex data for the polyhedron, including an option to scale all vertices using a multiplicative factor.

Parameters:
  • vertices (list) - list of numpy.array triples specifying the vertices of this polyhedron
  • scale (float) - multiplicative factor used to scale all vertices
Returns: list
a list of scaled Vertex

getFaces(self, vertices, all_indices, num_unique)

 

Create face data for the polyhedron.

Parameters:
  • vertices (list) - list of scaled Vertex
  • all_indices (list) - contains sub-lists specifying the vertex indices for each face
  • num_unique (int) - the number of symmetry unique edges per face
Returns: list
a list of Face

translateVertices(self, vertices, vector)

 

Translate the vertices by adding the specified vector.

Parameters:
  • vertices (list) - list of scaled Vertex
  • vector (numpy.array triple) - the vector used to translate the vertices

getSurfaceArea(self, faces)

 

Return the surface area of the polyhedron.

Parameters:
  • faces (list) - all Face objects for this polyhedron
Returns: float
the surface area in Ang.^2

getReferenceFaces(self, faces, num_unique)

 

Return a list containing the num_unique number of unique faces. These will be the reference faces used to orient the polyhedron.

Parameters:
  • faces (list) - all Face objects for this polyhedron
  • num_unique (int) - the number of symmetry unique faces per polyhedron
Returns: list
unique Face objects to serve as references

alignPolyhedron(self, vertices, face_vector, face_along, edge_vector, edge_along)

 

Return the polyhedron vertices rotated so as to align the face and edge vectors.

Parameters:
  • vertices (list) - list of Vertex
  • face_vector (numpy.array triple) - the normal of the reference face to be rotated
  • face_along (numpy.array triple) - the vector onto which the face normal will be rotated
  • edge_vector (numpy.array triple) - the vector of the reference edge to be rotated
  • edge_along (numpy.array triple) - the vector onto which the edge vector will be rotated, it is actually this vector's component that is perpendicular to face_along that is used in the alignment, this is to safeguard against the case where edge_along and face_along are not perpendicular, if they are the same an exception is raised
Returns: list
list of rotated Vertex

makeTemplate(self)

 

Create a template, i.e. structure object, for this convex polyhedron.

Returns: schrodinger.structure.Structure
the template structure

addPointsToTemplate(self, points)

 

Add the specified points to this convex polyhedron's template.

Parameters:
  • points (list of numpy.array) - contains the points to be added to the template for this convex polyhedron

getSegmentPlaneIntersections(self, line_start, line_end)

 

Return a two lists (1) of points where the given line segment intersects the planes containing this polyhedron's faces and (2) the centers of the faces whose planes are being intersected.

Parameters:
  • line_start (numpy.array) - the start of the line segment
  • line_end (numpy.array) - the end of the line segment
Returns: two lists of numpy.array
the intersection points and the centers of faces whose planes are being intersected

addSegmentPlaneIntersectionsToTemplate(self, line_start, line_end)

 

Add to this polyhedron's template the intersection points of the specified line segment and the planes containing the faces. Also draw connections between these points and the centers of the faces containing the planes that are being intersected.

Parameters:
  • line_start (numpy.array) - the start of the line segment
  • line_end (numpy.array) - the end of the line segment

pointInside(self, point)

 

Return True if the query point is either on or inside of this convex polyhedron.

Parameters:
  • point (numpy.array) - the point in question
Returns: bool
True if the point in question is either on or inside this polyhedron, False otherwise

allFacesIntersected(self)

 

Return True if all faces, not the planes containing those faces but the actual faces, of this convex polyhedron have been intersected at least once given all pointInside queries performed thus far.

Returns: bool
True if all faces have been intersected, False otherwise