/** * This method checks if two Joints have z-coordinates within a given tolerance * * @param origin * @param measured * @param tolerance * @return True if the z-coordinates are within tolerance */ public boolean InSameZPlane(Skeleton.Joint origin, Skeleton.Joint measured, double tolerance) { return Math.abs(measured.getZ() - origin.getZ()) < tolerance; }
/** * This method returns the angle (in degrees) of the vector pointing from Origin to Measured * projected to the YZ plane. If the mirrored parameter is true the vector is flipped about the * Y-axis. Mirroring is used to avoid the region where the atan2 function is discontinuous * * @param origin The Skeleton Joint to use as the origin point * @param measured The Skeleton Joint to use as the endpoint of the vector * @param mirrored Whether to mirror the Z coordinate of the joint about the Y-axis * @return The angle in degrees */ public double AngleYZ(Skeleton.Joint origin, Skeleton.Joint measured, boolean mirrored) { return Math.toDegrees( MathUtils.atan2( measured.getY() - origin.getY(), (mirrored) ? (origin.getZ() - measured.getZ()) : (measured.getZ() - origin.getZ()))); }