Documentation Index
Fetch the complete documentation index at: https://docs.tapkit.ai/llms.txt
Use this file to discover all available pages before exploring further.
Import from tapkit.geometry:
from tapkit.geometry import Point, NormalizedPoint, BBox, NormalizedBBox, Screen
Point
Absolute pixel coordinates:
p = Point(100, 200)
phone.tap(p)
x, y = p # Tuple unpacking
p.as_tuple() # (100, 200)
p.distance_to(p2) # Euclidean distance
NormalizedPoint
Relative coordinates (0.0-1.0):
center = NormalizedPoint(0.5, 0.5)
abs_point = center.to_absolute(phone.width, phone.height)
phone.tap(abs_point)
# From other scales
NormalizedPoint.from_1000_scale(500, 300) # 0-1000 range
NormalizedPoint.from_100_scale(50, 30) # 0-100 percentage
BBox
Absolute bounding box:
box = BBox(x1=100, y1=200, x2=300, y2=250)
box.center # Point at center
box.width # 200
box.height # 50
box.contains(point) # Check if point inside
box.as_tuple() # (100, 200, 300, 250)
phone.tap(box.center)
NormalizedBBox
Relative bounding box (0.0-1.0):
norm_box = NormalizedBBox(x1=0.1, y1=0.2, x2=0.3, y2=0.25)
abs_box = norm_box.to_absolute(phone.width, phone.height)
# From 0-1000 scale
NormalizedBBox.from_1000_scale(100, 200, 300, 250)
Screen
Access via phone.screen:
screen = phone.screen
screen.width # Screen width in pixels
screen.height # Screen height in pixels
screen.center # Center Point
screen.contains(p) # Check if point in bounds
screen.clamp(p) # Clamp point to valid range
# Coordinate conversion
screen.point_to_normalized(abs_point)
screen.point_to_absolute(norm_point)
screen.bbox_to_normalized(abs_box)
screen.bbox_to_absolute(norm_box)