Commits

German Larrain committed f033b6d

collision.base.RayContactData: made attributes private; added public properties;
added docstrings to class and constructor.

Comments (0)

Files changed (1)

ars/model/collision/base.py

 
 
 class RayContactData(object):
-	"""Contact information of a collision between `ray` and `shape`"""
+
+	"""Data structure to save the contact information of a collision
+	between :attr:`ray` and :attr:`shape`.
+
+	All attributes are read-only (set at initialization).
+
+	"""
 
 	def __init__(self, ray=None, shape=None, pos=None, normal=None, depth=None):
-		# -pos: point at which the ray intersects the surface of the other
-		# 	shape/geom.
-		# -normal: surface normal of the other geom at the contact point.
-		# -depth: distance from the start of the ray to the contact point.
-		# 	TODO: is it true?
-		self.ray = ray
-		self.shape = shape
-		self.position = pos
-		self.normal = normal
-		self.depth = depth
+		"""Constructor.
+
+		:param ray:
+		:type ray: the type of :class:`Ray` subclass' ``inner_object``
+		:param shape:
+		:type shape: the type of :class:`Geom` subclass' ``inner_object``
+		:param pos: point at which the ray intersects the surface of the other
+			shape/geom
+		:type pos: 3-tuple of floats
+		:param normal: vector normal to the surface of the other geom
+			at the contact point
+		:type normal: 3-tuple of floats
+		:param depth: distance from the origin of the ray to the contact point
+		:type depth: float
+
+		"""
+		self._ray = ray
+		self._shape = shape
+		self._position = pos
+		self._normal = normal
+		self._depth = depth
+
+	@property
+	def ray(self):
+		return self._ray
+
+	@property
+	def shape(self):
+		return self._shape
+
+	@property
+	def position(self):
+		return self._position
+
+	@property
+	def normal(self):
+		return self._normal
+
+	@property
+	def depth(self):
+		return self._depth
 
 
 class NearCallbackArgs(object):