def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) import scenic.syntax.veneer as veneer # TODO improve? veneer.registerObject(self) self.hw = hw = self.width / 2 self.hh = hh = self.height / 2 self.radius = hypot(hw, hh) # circumcircle; for collision detection self.inradius = min(hw, hh) # incircle; for collision detection self.left = self.relativePosition(-hw, 0) self.right = self.relativePosition(hw, 0) self.front = self.relativePosition(0, hh) self.back = self.relativePosition(0, -hh) self.frontLeft = self.relativePosition(-hw, hh) self.frontRight = self.relativePosition(hw, hh) self.backLeft = self.relativePosition(-hw, -hh) self.backRight = self.relativePosition(hw, -hh) self.corners = (self.frontRight.toVector(), self.frontLeft.toVector(), self.backLeft.toVector(), self.backRight.toVector()) camera = self.position.offsetRotated(self.heading, self.cameraOffset) self.visibleRegion = SectorRegion(camera, self.visibleDistance, self.heading, self.viewAngle) self._relations = []
def visibleRegion(self): camera = self.position.offsetRotated(self.heading, self.cameraOffset) return SectorRegion(camera, self.visibleDistance, self.heading, self.viewAngle)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.heading = toScalar(self.heading, f'"heading" of {self} not a scalar') self.visibleRegion = SectorRegion(self.position, self.visibleDistance, self.heading, self.viewAngle)
def visibleRegion(self): return SectorRegion(self.position, self.visibleDistance, self.heading, self.viewAngle)