Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to override 'pixel is inside'-test #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 21, 2016

  1. add option to override 'pixel is inside'-test

    a new option `isInside` can be used to specify a function that is called instead of the default `inside`-function to determine if the given coordinate is considered inside the shape. This can be useful for images that only vary in their opacity but are otherwise completely black. 
    
    As this is the only place where the source-image is actually accessed it can also be used to support ndarrays with shapes like `[width, height, 1]`.
    
    Example:
    
    ```javascript
    
    sourceImage = ndarray(imageData, [width, height, 4]);
    var output = sdf(sourceImage, { isInside: function(array, x, y)  { return array.get(x,y,3) > 128; }}
    
    ```
    usefulthink committed Oct 21, 2016
    Configuration menu
    Copy the full SHA
    4d820c9 View commit details
    Browse the repository at this point in the history