Skip to navigation

Maths (Geometry): GetVerticalDelta

Name: GetVerticalDelta [Show more] Type: Subroutine Category: Maths (Geometry) Summary: Calculate the difference in the y-axis between two objects as a signed delta
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * GetObjectAngles calls GetVerticalDelta

This routine calculates the following: yDelta(Hi Lo) = y-coordinate of object #Y - y-coordinate of object #X So yDelta(Hi Lo) contains the difference (the "delta") in the y-coordinate between the two objects, which is the difference in altitude.
Arguments: X The number of the first object Y The number of the second object
.GetVerticalDelta LDA yObjectLo,Y \ Set yDelta(Hi Lo) = yObject(Hi Lo) for object #Y SEC \ - yObject(Hi Lo) for object #X SBC yObjectLo,X \ STA yDeltaLo \ starting with the low bytes LDA yObjectHi,Y \ And then the high bytes SBC yObjectHi,X STA yDeltaHi RTS \ Return from the subroutine