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

Source reference: LIB/HIT.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/HIT.CC
Lines 26
Bytes 509
SHA-256 c61cbf7b1456bfa0b45c47e4084705a804e2aa6a1ba63f8f453d71a98d7e0c5b
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Detected syntactic dependencies

Line Include
— No preprocessor include detected.

Detected symbols

Line Symbol
4 hit_solid_at
8 hit_sweep

Complete source

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

#ifndef HIT_CC_H
#define HIT_CC_H

int hit_solid_at(float x, float y, float z) {
    return sim_solid(voxel_get((int)x, (int)y, (int)z));
}

int hit_sweep(float x, float y, float z, float dx, float dy, float dz, int n) {
    int i;
    float t;
    float u;
    if (n < 1)
        n = 1;
    i = 1;
    while (i <= n) {
        t = (float)i;
        u = (float)n;
        if (hit_solid_at(x + dx * t / u, y + dy * t / u, z + dz * t / u))
            return i;
        i = i + 1;
    }
    return 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-c61cbf7b1456bfa0 Reviewed source: da3df29cb397 Class: generated-source-reference