Commits

German Larrain committed 8792ccc

collision.base.Trimesh: added detailed class docstring.

  • Participants
  • Parent commits 9564ee9

Comments (0)

Files changed (1)

File ars/model/collision/base.py

 
 class Trimesh(Geom):
 
+	"""A triangular mesh i.e. a surface composed of triangular faces.
+
+	.. note::
+	   Note that a trimesh need not be closed. For example, it could be
+	   used to model the ground surface.
+
+	Its geometry is defined by two attributes: :attr:`vertices` and
+	:attr:`faces`, both list of 3-tuple numbers. However, each tuple
+	in :attr:`vertices` designates a 3D point in space whereas each tuple
+	in :attr:`faces` is a group of indices referencing points in
+	:attr:`vertices`.
+
+	.. warning::
+	   The order of vertices indices for each face **does** matter.
+
+	Example::
+
+		vertices = [(0, 0.0, 0), (0, 0.0, 1), (0, 0.0, 2), (0, 0.0, 3),
+		            (1, 0.0, 0), (1, 0.0, 1), (1, 0.0, 2), (1, 0.0, 3)]
+
+		faces = [(0, 1, 4), (1, 5, 4), (1, 6, 5),
+		         (1, 2, 6), (2, 3, 6), (3, 7, 6)]
+
+	The, the first face is defined by points:
+	``(0, 0.0, 0), (0, 0.0, 1), (1, 0.0, 0)``.
+	With that order, the normal to the face is ``(0, 1.0, 0)`` i.e. the Y axis.
+	The rationale to determining the *inwards* and *outwards* directions
+	follows the well-known "right hand rule".
+
+	"""
+
 	@abstractmethod
 	def __init__(self, space, vertices, faces):
 		super(Trimesh, self).__init__()