Module Expr Str Import alias Import alias ClassDef bases body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr ListLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr Lambda arguments args NameParam NameParam defaults BinOpAdd NameLoad NameLoad NameLoad decorator_list Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad ListComp Call NameLoad Call NameLoad NameLoad SubscriptLoad NameLoad Slice Num comprehension NameStore NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str If BoolOpOr CompareEq AttributeLoad NameLoad attr NameLoad CompareGt Call AttributeLoad BinOpSub AttributeLoad NameLoad attr NameLoad attr Num body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr ListLoad Assign NameStore BinOpMult NameLoad NameLoad Assign NameStore Lambda arguments args NameParam NameParam defaults Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults Call AttributeLoad BinOpSub NameLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd CompareLt Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Num CompareLt Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Num decorator_list FunctionDef arguments args NameParam defaults body For NameStore AttributeLoad NameLoad attr body If Call NameLoad NameLoad NameLoad body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad AttributeLoad NameLoad attr If CompareNotIn NameLoad NameLoad body If CompareGt Call AttributeLoad BinOpSub NameLoad NameLoad attr NameLoad body Return NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Return NameLoad For NameStore NameLoad body If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num body If BoolOpAnd CompareNotEq SubscriptLoad NameLoad Index Num NameLoad CompareNotEq SubscriptLoad NameLoad Index Num NameLoad body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return CompareLtE Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num NameLoad decorator_list Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad Call NameLoad NameLoad Call NameLoad BinOpAdd AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad BinOpAdd Call NameLoad Call NameLoad AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Slice Num ListLoad TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListComp TupleLoad NameLoad Num comprehension NameStore NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListComp TupleLoad NameLoad Num comprehension NameStore NameLoad For NameStore NameLoad body Assign NameStore Num While CompareLt NameLoad Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad If BoolOpAnd CompareGt Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Num Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad NameLoad attr NameLoad orelse AugAssignAdd NameStore Num AugAssignAdd NameStore NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Num While CompareLt NameLoad Call NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index BinOpSub NameLoad Num Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index BinOpMod BinOpAdd NameLoad Num Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad BinOpAdd Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore ListComp NameLoad comprehension NameStore NameLoad BoolOpAnd CompareNotEq NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListComp TupleLoad NameLoad Num comprehension NameStore NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults AttributeLoad BinOpSub NameLoad NameLoad attr Assign NameStore Call NameLoad TupleLoad NameLoad NameLoad Assign NameStore Call NameLoad TupleLoad NameLoad NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad AugAssignAdd NameStore Num If Call NameLoad TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index BinOpSub NameLoad Num SubscriptLoad AttributeLoad NameLoad attr Index BinOpSub NameLoad Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index BinOpSub NameLoad Num AugAssignSub NameStore Num orelse If BoolOpAnd NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd NameLoad Num NameLoad AugAssignAdd NameStore Num AugAssignAdd NameStore Num If Call NameLoad TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign TupleStore SubscriptStore AttributeLoad NameLoad attr Index Num SubscriptStore AttributeLoad NameLoad attr Index Num TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list decorator_list
N/A N/A Calculation of polygonal Field of View (FOV) N/A functools N/A py2d.Math Vision N/A N/A N/A Class for representing a polygonal field of vision (FOV).

	It requires a list of obstructors, given as line strips made of lists of vectors (i.e. we have a list of lists of vectors).
	The vision polygon will be cached as long as the eye position and obstructors don't change.

		>>> obs = [[ py2d.Math.Vector(2,4), py2d.Math.Vector(4, 1), py2d.Math.Vector(7, -2) ],
		...        [ py2d.py2d.Math.Vector(1,-2), py2d.Math.Vector(6, -3) ],
		...	   [ py2d.Math.Vector(2.5,5), py2d.Math.Vector(3, 4) ]]
		>>> radius = 20
		>>> eye = py2d.Math.Vector(0,0)
		>>> boundary = py2d.Math.Polygon.regular(eye, radius, 4)
		>>> v = Vision(obs)
		>>> poly = v.get_vision(eye, radius, boundary)
		>>> poly.points[0:6]
		[Vector(4.000, 1.000), Vector(2.000, 4.000), Vector(2.000, 4.000), Vector(0.000, 20.000), Vector(0.000, 20.000), Vector(-20.000, 0.000)]
		>>> poly.points[6:]
		[Vector(-20.000, 0.000), Vector(-0.000, -20.000), Vector(-0.000, -20.000), Vector(1.000, -2.000), Vector(1.000, -2.000), Vector(6.000, -3.000), Vector(6.000, -3.000), Vector(7.000, -2.000), Vector(7.000, -2.000)]
	 __init__ N/A N/A self obstructors debug N/A False N/A N/A Create a new vision object.

		@type obstructors: list
		@param obstructors: A list of obstructors. Obstructors are a list of vectors, so this should be a list of lists.
		 N/A N/A N/A self set_obstructors obstructors N/A N/A self debug debug N/A N/A self debug_points N/A N/A N/A self debug_linesegs N/A N/A set_obstructors N/A N/A self obstructors N/A N/A N/A Set new obstructor data for the Vision object.

		This will also cause the vision polygon to become invalidated, resulting in a re-calculation the next time you access it.

		@type obstructors: list
		@param obstructors: A list of obstructors. Obstructors are a list of vectors, so this should be a list of lists.
		 flatten_list N/A N/A l N/A N/A N/A N/A N/A functools reduce N/A N/A N/A x y N/A N/A x y l N/A N/A N/A self obs_points N/A flatten_list obstructors N/A N/A self obs_segs N/A flatten_list N/A N/A list N/A zip strip N/A strip N/A 1 N/A strip obstructors N/A N/A self cached_vision None N/A N/A self cached_position None N/A N/A self cached_radius None N/A get_vision N/A N/A self eye radius boundary N/A N/A N/A Get a vision polygon for a given eye position and boundary Polygon.

		@type eye: Vector
		@param eye: The position of the viewer (normally the center of the boundary polygon)
		@type radius: float
		@param radius: The maximum vision radius (normally the radius of the boundary polygon)
		@type boundary: Polygon
		@param boundary: The boundary polygon that describes the maximal field of vision
		 N/A N/A N/A N/A self cached_vision None N/A N/A N/A N/A N/A self cached_position eye get_length_squared 1 N/A N/A N/A N/A self calculate eye radius boundary N/A N/A self cached_vision N/A calculate N/A N/A self eye radius boundary N/A N/A N/A Re-calculate the vision polygon.

		WARNING: You should only call this if you want to re-calculate the vision polygon for some reason.

		For normal usage, use L{get_vision} instead!
		 N/A N/A self cached_radius radius N/A N/A self cached_position eye N/A N/A self debug_points N/A N/A N/A self debug_linesegs N/A N/A radius_squared N/A radius radius N/A closest_points N/A N/A N/A points reference N/A N/A sorted points key N/A N/A N/A p N/A N/A N/A N/A p reference get_length_squared sub_segment N/A N/A small big N/A N/A N/A N/A N/A N/A N/A N/A py2d Math distance_point_lineseg_squared N/A small N/A 0 N/A big N/A 0 N/A big N/A 1 0.0001 N/A N/A N/A N/A py2d Math distance_point_lineseg_squared N/A small N/A 1 N/A big N/A 0 N/A big N/A 1 0.0001 N/A segment_in_obs N/A N/A seg N/A N/A N/A line_segment N/A self obs_segs N/A N/A N/A sub_segment seg line_segment N/A N/A True N/A False N/A check_visibility N/A N/A p N/A N/A N/A bpoints N/A set N/A boundary points N/A N/A p bpoints N/A N/A N/A N/A N/A N/A eye p get_length_squared radius_squared N/A N/A False N/A N/A N/A N/A boundary contains_point p N/A N/A False N/A line_segment obs_segs N/A N/A N/A N/A N/A py2d Math check_intersect_lineseg_lineseg eye p N/A line_segment N/A 0 N/A line_segment N/A 1 N/A N/A N/A N/A N/A line_segment N/A 0 p N/A N/A line_segment N/A 1 p N/A N/A False N/A True N/A lineseg_in_radius N/A N/A seg N/A N/A N/A N/A N/A N/A N/A py2d Math distance_point_lineseg_squared eye N/A seg N/A 0 N/A seg N/A 1 radius_squared N/A N/A obs_segs N/A filter lineseg_in_radius N/A self obs_segs N/A visible_points N/A list N/A filter check_visibility N/A set N/A N/A self obs_points N/A boundary points N/A boundary_intersection_points N/A N/A N/A py2d Math intersect_linesegs_linesegs obs_segs N/A N/A list N/A zip N/A boundary points N/A N/A boundary points N/A 1 N/A N/A N/A N/A boundary points N/A -1 N/A N/A boundary points N/A 0 N/A N/A self debug N/A N/A N/A N/A N/A self debug_points extend N/A N/A p 16711680 N/A p visible_points N/A N/A self debug N/A N/A N/A N/A N/A self debug_points extend N/A N/A p 65535 N/A p boundary_intersection_points N/A line_segment obs_segs N/A N/A i 0 N/A N/A i N/A len boundary_intersection_points N/A N/A p N/A boundary_intersection_points N/A i N/A N/A N/A N/A N/A N/A py2d Math distance_point_lineseg_squared p N/A line_segment N/A 0 N/A line_segment N/A 1 0.0001 N/A N/A N/A py2d Math check_intersect_lineseg_lineseg eye p N/A line_segment N/A 0 N/A line_segment N/A 1 N/A N/A N/A N/A boundary_intersection_points remove p N/A N/A i 1 N/A visible_points boundary_intersection_points N/A poly N/A N/A N/A py2d Math Polygon N/A N/A N/A poly add_points visible_points N/A N/A N/A poly sort_around eye N/A i 0 N/A N/A i N/A len N/A poly points N/A N/A p N/A N/A poly points N/A N/A i 1 N/A c N/A N/A poly points N/A i N/A n N/A N/A poly points N/A N/A N/A i 1 N/A len N/A poly points N/A intersections N/A set N/A N/A N/A N/A py2d Math intersect_linesegs_ray obs_segs eye c N/A N/A N/A py2d Math intersect_poly_ray N/A boundary points eye c N/A intersections N/A ip N/A ip intersections N/A N/A ip c N/A N/A boundary contains_point ip N/A N/A self debug N/A N/A N/A N/A N/A self debug_points extend N/A N/A pt 65280 N/A pt intersections N/A intersections N/A N/A intersection N/A min intersections key N/A N/A N/A p N/A N/A N/A p eye length_squared N/A sio_pc N/A segment_in_obs N/A p c N/A sio_cn N/A segment_in_obs N/A c n N/A N/A sio_pc N/A N/A N/A N/A N/A poly points insert i intersection N/A i 1 N/A N/A segment_in_obs N/A N/A N/A poly points N/A N/A i 3 N/A N/A poly points N/A N/A i 1 N/A N/A N/A N/A N/A poly points remove N/A N/A poly points N/A N/A i 2 N/A i 1 N/A N/A N/A sio_pc N/A sio_cn N/A N/A N/A N/A N/A poly points insert N/A i 1 intersection N/A i 1 N/A i 1 N/A N/A segment_in_obs N/A N/A N/A poly points N/A -1 N/A N/A poly points N/A 1 N/A N/A N/A N/A N/A poly points N/A 0 N/A N/A poly points N/A 1 N/A N/A N/A poly points N/A 1 N/A N/A poly points N/A 0 N/A N/A self cached_vision poly N/A poly N/A N/A