Package 

Class Angles


  • 
    public class Angles
    
                        

    Manages offsets between different Reference systems. These offsets are computed based on the setSensorOffset, setDisplayOffset and setDeviceOrientation values that are coming from outside. When communicating with the sensor, RELATIVE_TO_SENSOR should probably be used. This means inverting the offset when using the front camera. This is often the case when calling offset(SENSOR, OUTPUT), for example when passing a JPEG rotation to the sensor. That is meant to be consumed as relative to the sensor plane. For all other usages, ABSOLUTE is probably a better choice.

    • Method Summary

      Modifier and Type Method Description
      void setSensorOffset(@NonNull() Facing sensorFacing, int sensorOffset) We want to keep everything in the ABSOLUTE reference,so a front facing sensor offset must be inverted.
      void setDisplayOffset(int displayOffset) Sets the display offset.
      void setDeviceOrientation(int deviceOrientation) Sets the device orientation.
      int offset(@NonNull() Reference from, @NonNull() Reference to, @NonNull() Axis axis) Returns the offset between two reference systems, computed along the given axis.
      boolean flip(@NonNull() Reference from, @NonNull() Reference to) Whether the two references systems are flipped.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setSensorOffset

         void setSensorOffset(@NonNull() Facing sensorFacing, int sensorOffset)

        We want to keep everything in the ABSOLUTE reference,so a front facing sensor offset must be inverted.

        Parameters:
        sensorFacing - sensor facing value
        sensorOffset - sensor offset
      • setDisplayOffset

         void setDisplayOffset(int displayOffset)

        Sets the display offset.

        Parameters:
        displayOffset - the display offset
      • setDeviceOrientation

         void setDeviceOrientation(int deviceOrientation)

        Sets the device orientation.

        Parameters:
        deviceOrientation - the device orientation
      • offset

         int offset(@NonNull() Reference from, @NonNull() Reference to, @NonNull() Axis axis)

        Returns the offset between two reference systems, computed along the given axis.

        Parameters:
        from - the source reference system
        to - the destination reference system
        axis - the axis