Beispiel #1
0
def In(region):
	# TODO fix type checking
	#region = toType(region, Region, 'specifier "in/on R" with R not a Region')
	if isinstance(region, Distribution):
		extras = {'heading'}	# TODO fix hack!!!
	else:
		extras = {} if region.orientation is None else {'heading'}
	return Specifier('position', Region.uniformPointIn(region), optionals=extras)
Beispiel #2
0
def In(region):
	"""The 'in/on <region>' specifier.

	Specifies 'position', with no dependencies. Optionally specifies 'heading'
	if the given Region has a preferred orientation.
	"""
	region = toType(region, Region, 'specifier "in/on R" with R not a Region')
	extras = {'heading'} if alwaysProvidesOrientation(region) else {}
	return Specifier('position', Region.uniformPointIn(region), optionals=extras)
Beispiel #3
0
def VisibleFrom(base):
	"""The 'visible from <Point>' specifier.

	Specifies 'position', with no dependencies.

	This uses the given object's 'visibleRegion' property, and so correctly
	handles the view regions of Points, OrientedPoints, and Objects.
	"""
	if not isinstance(base, Point):
		raise RuntimeParseError('specifier "visible from O" with O not a Point')
	return Specifier('position', Region.uniformPointIn(base.visibleRegion))
Beispiel #4
0
def VisibleFrom(base):
	if not isinstance(base, Point):
		raise RuntimeParseError('specifier "visible from O" with O not a Point')
	return Specifier('position', Region.uniformPointIn(base.visibleRegion))