LYGIA Shader Library

contain (lygia/geometry/aabb/contain)

Compute if point is inside AABB

Dependencies:

Use:

<bool> contain(<AABB> box, <vec3> point )

Check it on Github




#ifndef FNC_AABB_CONTAIN
#define FNC_AABB_CONTAIN

bool contain(const in AABB box, const in vec3 point ) {
    return  all( lessThanEqual(point, box.max) ) && 
            all( lessThan(box.min, point) );
}

#endif

Dependencies:

Use:

<bool> inside(<AABB> box, <float3> point )

Check it on Github




#ifndef FNC_AABB_CONTAIN
#define FNC_AABB_CONTAIN

bool contain(const in AABB _box, const in float3 _point ) {
    return  (_point.x >= _box.min.x && _point.x <= _box.max.x) &&
            (_point.y >= _box.min.y && _point.y <= _box.max.y) &&
            (_point.z >= _box.min.z && _point.z <= _box.max.z);
}

#endif

Dependencies:

Use:

<bool> contain(<AABB> box, <vec3> point )

Check it on Github




#ifndef FNC_AABB_CONTAIN
#define FNC_AABB_CONTAIN

inline __host__ __device__ bool contain(const AABB& _box, const float3& _point ) {
    return  (_point.x >= _box.min.x && _point.x <= _box.max.x) &&
            (_point.y >= _box.min.y && _point.y <= _box.max.y) &&
            (_point.z >= _box.min.z && _point.z <= _box.max.z);
}

#endif

Licenses

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository