LYGIA Shader Library

expand (lygia/geometry/aabb/expand)

expand AABB

Dependencies:

Use:

<bool> expand(<AABB> box, <AABB|vec3|float> point )

Check it on Github




#ifndef FNC_AABB_EXPAND
#define FNC_AABB_EXPAND

void expand(inout AABB _box, const in float _value ) {
    _box.min -= _value;
    _box.max += _value;
}

void expand(inout AABB _box, const in vec3 _point ) {
    _box.min = min(_box.min, _point);
    _box.max = max(_box.max, _point);
}

void expand(inout AABB _box, const in AABB _other ) {
    expand(_box, _other.min); 
    expand(_box, _other.max);
}

#endif

Dependencies:

Use:

<bool> expand(<AABB> box, <AABB|float3|float> point )

Check it on Github




#ifndef FNC_AABB_EXPAND
#define FNC_AABB_EXPAND

void expand(inout AABB _box, const float _value ) {
    _box.min -= _value;
    _box.max += _value;
}

void expand(inout AABB _box, const float3 _point ) {
    _box.min = min(_box.min, _point);
    _box.max = max(_box.max, _point);
}

void expand(inout AABB _box, const AABB _other ) {
    expand(_box, _other.min); 
    expand(_box, _other.max);
}

#endif

Dependencies:

Use:

<bool> expand(<AABB> box, <AABB|float3|float> point )

Check it on Github




#ifndef FNC_AABB_EXPAND
#define FNC_AABB_EXPAND

inline __host__ __device__ void expand(AABB& _box, float _value ) {
    _box.min -= _value;
    _box.max += _value;
}

inline __host__ __device__ void expand(AABB& _box, const float3& _point ) {
    _box.min = min(_box.min, _point);
    _box.max = max(_box.max, _point);
}

inline __host__ __device__ void expand(AABB& _box, const Triangle& _tri ) {
    expand(_box, _tri.a); expand(_box, _tri.b); expand(_box, _tri.c);
}

inline __host__ __device__ void expand(AABB& _box, const AABB& _other ) {
    expand(_box, _other.min); 
    expand(_box, _other.max);
}

#endif

License

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