# azmine-1/my-ray-tracer architecture

> Architecture diagram of the GitHub repository azmine-1/my-ray-tracer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azmine-1/my-ray-tracer
- Repository: https://github.com/azmine-1/my-ray-tracer

## Overview

This is a small C++ ray-tracing renderer. The checked-in main program constructs primary rays and writes PPM-formatted output, but its current pixel loop writes pixel positions as colors and does not call its gradient helper. The separate camera implementation contains the documented sampling, intersection, and material-scattering workflow; the excerpts do not show it being invoked by main. README capabilities are represented, while unsupported connections between the two paths are omitted.

Main entry points: [`camera.h`](https://github.com/azmine-1/my-ray-tracer/blob/main/camera.h) (Camera Renderer), [`main.cc`](https://github.com/azmine-1/my-ray-tracer/blob/main/main.cc) (Program Entry), [`ray.h`](https://github.com/azmine-1/my-ray-tracer/blob/main/ray.h) (Ray), [`color.h`](https://github.com/azmine-1/my-ray-tracer/blob/main/color.h) (Color Output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_render["Rendering"]
  node_main["Program Entry<br/>[main.cc]"]
  node_camera["Camera Renderer<br/>[camera.h]"]
  node_ppm["PPM Output"]
end

subgraph group_scene["Scene Geometry"]
  node_hitlist["Object Collection<br/>[hittable_list.h]"]
  node_hittable["Hit Interface<br/>[hittable.h]"]
  node_sphere["Sphere Intersection<br/>[sphere.h]"]
  node_materials["Surface Materials<br/>[material.h]"]
end

subgraph group_core["Ray and Color Core"]
  node_ray["Ray<br/>[ray.h]"]
  node_vector["Vector Math<br/>[vec3.h]"]
  node_color["Color Output<br/>[color.h]"]
  node_interval["Ray Interval<br/>[interval.h]"]
end

node_user(("User"))

node_user -->|"runs"| node_main
node_main -->|"constructs"| node_ray
node_main -->|"writes"| node_color
node_color -->|"uses"| node_vector
node_ray -->|"uses"| node_vector
node_main -->|"emits"| node_ppm
node_camera -->|"generates"| node_ray
node_camera -->|"queries"| node_hitlist
node_camera -->|"scatters through"| node_materials
node_camera -->|"writes samples"| node_color
node_camera -->|"bounds hits"| node_interval
node_hitlist -->|"dispatches hits"| node_hittable
node_sphere -->|"implements"| node_hittable
node_materials -->|"scatters rays"| node_ray

click node_main "https://github.com/azmine-1/my-ray-tracer/blob/main/main.cc"
click node_camera "https://github.com/azmine-1/my-ray-tracer/blob/main/camera.h"
click node_hitlist "https://github.com/azmine-1/my-ray-tracer/blob/main/hittable_list.h"
click node_hittable "https://github.com/azmine-1/my-ray-tracer/blob/main/hittable.h"
click node_sphere "https://github.com/azmine-1/my-ray-tracer/blob/main/sphere.h"
click node_materials "https://github.com/azmine-1/my-ray-tracer/blob/main/material.h"
click node_ray "https://github.com/azmine-1/my-ray-tracer/blob/main/ray.h"
click node_vector "https://github.com/azmine-1/my-ray-tracer/blob/main/vec3.h"
click node_color "https://github.com/azmine-1/my-ray-tracer/blob/main/color.h"
click node_interval "https://github.com/azmine-1/my-ray-tracer/blob/main/interval.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_camera,node_ppm,node_user toneBlue
class node_hitlist,node_hittable,node_sphere,node_materials toneAmber
class node_ray,node_vector,node_color,node_interval toneMint
```

## Components

### Rendering

- [Program Entry](https://github.com/azmine-1/my-ray-tracer/blob/main/main.cc): `main.cc`
- [Camera Renderer](https://github.com/azmine-1/my-ray-tracer/blob/main/camera.h): `camera.h`
- **PPM Output**

### Scene Geometry

- [Object Collection](https://github.com/azmine-1/my-ray-tracer/blob/main/hittable_list.h): `hittable_list.h`
- [Hit Interface](https://github.com/azmine-1/my-ray-tracer/blob/main/hittable.h): `hittable.h`
- [Sphere Intersection](https://github.com/azmine-1/my-ray-tracer/blob/main/sphere.h): `sphere.h`
- [Surface Materials](https://github.com/azmine-1/my-ray-tracer/blob/main/material.h): `material.h`

### Ray and Color Core

- [Ray](https://github.com/azmine-1/my-ray-tracer/blob/main/ray.h): `ray.h`
- [Vector Math](https://github.com/azmine-1/my-ray-tracer/blob/main/vec3.h): `vec3.h`
- [Color Output](https://github.com/azmine-1/my-ray-tracer/blob/main/color.h): `color.h`
- [Ray Interval](https://github.com/azmine-1/my-ray-tracer/blob/main/interval.h): `interval.h`

### Other components

- **User**

## Connections

- User → Program Entry: runs (evidence: `README.md`)
- Program Entry → Ray: constructs (evidence: `main.cc`)
- Program Entry → Color Output: writes (evidence: `main.cc`)
- Color Output → Vector Math: uses (evidence: `color.h`)
- Ray → Vector Math: uses (evidence: `ray.h`)
- Program Entry → PPM Output: emits (evidence: `main.cc`)
- Camera Renderer → Ray: generates (evidence: `camera.h`)
- Camera Renderer → Object Collection: queries (evidence: `camera.h`)
- Camera Renderer → Surface Materials: scatters through (evidence: `camera.h`)
- Camera Renderer → Color Output: writes samples (evidence: `camera.h`)
- Camera Renderer → Ray Interval: bounds hits (evidence: `camera.h`)
- Object Collection → Hit Interface: dispatches hits (evidence: `hittable_list.h`)
- Sphere Intersection → Hit Interface: implements (evidence: `sphere.h`)
- Surface Materials → Ray: scatters rays (evidence: `material.h`)
