Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
    
    GestureUtils
    class GestureUtils
    
    Utility functions for gesture processing & analysis, including methods for: 
      
 
        - feature extraction (e.g., samplers and those for calculating bounding boxes and gesture path lengths); 
 
        - geometric transformation (e.g., translation, rotation and scaling); 
 
        - gesture similarity comparison (e.g., calculating Euclidean or Cosine distances between two gestures). 
 
      
    
    Summary
    
      
        
          | Public methods | 
        
        
          | static OrientedBoundingBox! | 
          
            
             Computes an oriented, minimum bounding box of a set of points. 
           | 
        
        
          | static OrientedBoundingBox! | 
          
            
             Computes an oriented, minimum bounding box of a set of points. 
           | 
        
        
          | static FloatArray! | 
          
            
             Samples the gesture spatially by rendering the gesture into a 2D grayscale bitmap. 
           | 
        
        
          | static FloatArray! | 
          
            
             Samples the gesture spatially by rendering the gesture into a 2D grayscale bitmap. 
           | 
        
        
          | static FloatArray! | 
          
            
             Samples a stroke temporally into a given number of evenly-distributed points. 
           | 
        
      
    
    Public methods
    
      computeOrientedBoundingBox
      
      static fun computeOrientedBoundingBox(originalPoints: FloatArray!): OrientedBoundingBox!
      Computes an oriented, minimum bounding box of a set of points.
      
      
     
    
    
      spatialSampling
      
      static fun spatialSampling(
    gesture: Gesture!, 
    bitmapSize: Int
): FloatArray!
      Samples the gesture spatially by rendering the gesture into a 2D grayscale bitmap. Scales the gesture to fit the size of the bitmap. The scaling does not necessarily keep the aspect ratio of the gesture.
      
        
          
            | Parameters | 
          
          
            gesture | 
            Gesture!: the gesture to be sampled | 
          
          
            bitmapSize | 
            Int: the size of the bitmap | 
          
        
      
      
        
          
            | Return | 
          
          
            FloatArray! | 
            a bitmapSize x bitmapSize grayscale bitmap that is represented as a 1D array. The float at index i represents the grayscale value at pixel [i%bitmapSize, i/bitmapSize] | 
          
        
      
     
    
      spatialSampling
      
      static fun spatialSampling(
    gesture: Gesture!, 
    bitmapSize: Int, 
    keepAspectRatio: Boolean
): FloatArray!
      Samples the gesture spatially by rendering the gesture into a 2D grayscale bitmap. Scales the gesture to fit the size of the bitmap.
      
        
          
            | Parameters | 
          
          
            gesture | 
            Gesture!: the gesture to be sampled | 
          
          
            bitmapSize | 
            Int: the size of the bitmap | 
          
          
            keepAspectRatio | 
            Boolean: if the scaling should keep the gesture's aspect ratio | 
          
        
      
      
        
          
            | Return | 
          
          
            FloatArray! | 
            a bitmapSize x bitmapSize grayscale bitmap that is represented as a 1D array. The float at index i represents the grayscale value at pixel [i%bitmapSize, i/bitmapSize] | 
          
        
      
     
    
      temporalSampling
      
      static fun temporalSampling(
    stroke: GestureStroke!, 
    numPoints: Int
): FloatArray!
      Samples a stroke temporally into a given number of evenly-distributed points.
      
        
          
            | Parameters | 
          
          
            stroke | 
            GestureStroke!: the gesture stroke to be sampled | 
          
          
            numPoints | 
            Int: the number of points | 
          
        
      
      
        
          
            | Return | 
          
          
            FloatArray! | 
            the sampled points in the form of [x1, y1, x2, y2, ..., xn, yn] | 
          
        
      
     
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]