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

Source reference: LIB/BODY.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/BODY.CC
Lines 33
Bytes 662
SHA-256 86f820690f0a2c29697a33524218cb19494657f4014b1fc7b6c0a2119a7cc4a4
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Detected syntactic dependencies

Line Include
— No preprocessor include detected.

Detected symbols

Line Symbol
4 body_step_y
11 body_step_vy
19 body_hit

Complete source

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

#ifndef BODY_CC_H
#define BODY_CC_H

float body_step_y(float y, float vy, float dt, float g, float radius) {
    y = y + vy * dt;
    if (y < radius)
        y = radius;
    return y;
}

float body_step_vy(float y, float vy, float dt, float g, float radius) {
    vy = vy + g * dt;
    y = y + vy * dt;
    if (y < radius)
        vy = 0.0 - vy * 0.3;
    return vy;
}

int body_hit(float ax, float ay, float az, float ar, float bx, float by,
             float bz, float br) {
    float dx;
    float dy;
    float dz;
    float r;
    dx = ax - bx;
    dy = ay - by;
    dz = az - bz;
    r = ar + br;
    return dx * dx + dy * dy + dz * dz < r * r;
}

#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-86f820690f0a2c29 Reviewed source: da3df29cb397 Class: generated-source-reference