ChrisOS Research ProjectOperating systems · language systems · graphics · machine emulation
DOCUMENTATION ARCHIVEMAIN BRANCH
ChrisOS/Source reference: LIB/CLIP.CC

Source reference: LIB/CLIP.CC

Deterministic source record. The complete textual file is reproduced below; this page does not replace architectural interpretation in the authored chapters.

File identity

Field Value
Path LIB/CLIP.CC
Lines 28
Bytes 693
SHA-256 8ede9bbf18a2293afb761bfbd42233bfd3170da6d061f20ae65b89236b095206
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Detected syntactic dependencies

Line Include
— No preprocessor include detected.

Detected symbols

Line Symbol
4 clip_aabb
15 clip_ray_aabb

Complete source

The following block is the complete textual file at the recorded revision. No lines are elided, abbreviated or paraphrased.

#ifndef CLIP_CC_H
#define CLIP_CC_H

int clip_aabb(float ax, float ay, float az, float as,
              float bx, float by, float bz, float bs) {
    if (ax + as < bx || bx + bs < ax)
        return 0;
    if (ay + as < by || by + bs < ay)
        return 0;
    if (az + as < bz || bz + bs < az)
        return 0;
    return 1;
}

int clip_ray_aabb(float ox, float oy, float oz,
                  float dx, float dy, float dz,
                  float bx, float by, float bz, float s) {
    float t;
    if (dx == 0.0)
        return clip_aabb(ox, oy, oz, 0.1, bx, by, bz, s);
    t = (bx - ox) / dx;
    if (t < 0.0)
        t = (bx + s - ox) / dx;
    return t >= 0.0 && t < 64.0;
}

#endif

Role of this record

The atlas guarantees file-by-file traceability. Responsibility, invariants, ownership, concurrency, security, performance and subsystem interactions belong in authored chapters and must cite this file when applicable.

Document record ID: source-8ede9bbf18a2293a Reviewed source: da3df29cb397 Class: generated-source-reference