pyrw.RWessentials module¶
-
pyrw.RWessentials.
angle_from_vertices
(vcenter, vstart, vend, samedist=False)¶ Returns angle between two vertices around vcenter.
Parameters: - vcenter (pyrw.geometry.vertex) – Vertex object.
- vstart (pyrw.geometry.vertex) – Vertex object.
- vend (pyrw.geometry.vertex) – Vertex object.
- samedist (bool) – Flag if vectors need to have same length.
Returns: float – angle
-
pyrw.RWessentials.
checkInsideCircle
(x, center, radius, tol=1e-30, debug=False)¶ Returns True if x is inside circle.
Parameters: - x (array) – Coordinate.
- center (float) – Coordinate of center.
- radius (float) – Radius of circle.
- center – Tolerance added to check to avoid rounding errors.
- debug (bool) – Debugging flag.
Returns: bool – True if inside
-
pyrw.RWessentials.
checkInsidePoly
(coord, poly)¶ Returns True if coord is inside poly.
Taken from http://www.ariel.com.au/a/python-point-int-poly.html
Parameters: - coord (array) – Coordinate.
- poly (list) – Polygon corners.
Returns: bool – True if inside
-
pyrw.RWessentials.
combinations
(arrays, out=None)¶ Returns cartesian product of arrays.
Parameters: - arrays (list) – List of arrays.
- out (array) – Result vector.
Returns: array – Cartesian product
-
pyrw.RWessentials.
compute_angle
(vec1, vec2)¶ Returns angle between two vectors.
Parameters: - vec1 (array) – Vector.
- vec2 (array) – Vector.
Returns: float – angle
-
pyrw.RWessentials.
create_arc_curve
(vcenter, angle, angle_offset, radius, steps=100)¶ Creates array with points describing the curve of an arc.
Parameters: - vcenter (pyrw.geometry.vertex) – Vertex object.
- angle (float) – Angle of arc.
- angle_offset (float) – Offset angle of arc.
- radius (float) – radius of arc.
- steps (int) – number of steps for arc.
Returns: (array,array) – vectors describing x/y-coordinates
-
pyrw.RWessentials.
cross2d
(x1, x2)¶ Returns reduced 2D cross product.
Parameters: - x1 (array) – Coordinate 1.
- x2 (array) – Coordinate 2.
Returns: float – cross product
-
pyrw.RWessentials.
direc_angle
(v1, v2)¶ Returns directional angle.
Parameters: - v1 (array) – Vector.
- v2 (array) – Vector.
Returns: array – directional angle
-
pyrw.RWessentials.
dist
(p1, p2)¶ Returns euclidean distance between two points.
Parameters: - p1 (array) – Point 1.
- p2 (array) – Point 2.
Returns: float – distance
-
pyrw.RWessentials.
norm
(vec)¶ Returns L2-norm of vector.
Parameters: vec (array) – Vector. Returns: float – length of vector
-
pyrw.RWessentials.
outwPerp
(x, c)¶ Returns outward perpendicular vector.
Parameters: - x (array) – Vector.
- c (array) – Center coordinate.
Returns: array – perpendicular vector
-
pyrw.RWessentials.
perp
(x)¶ Returns perpendicular vector.
Parameters: x (array) – Vector. Returns: array – perpendicular vector
-
pyrw.RWessentials.
unit_vector
(vector)¶ Returns unit vector.
Parameters: vector (array) – Vector. Returns: array – unit vector