@startuml class Vector { +x: number +y: number +z: number +{static} times(k: number, v: Vector): Vector +{static} minus(v1: Vector, v2: Vector): Vector +{static} plus(v1: Vector, v2: Vector): Vector +{static} dot(v1: Vector, v2: Vector): number +{static} mag(v: Vector): number +{static} norm(v: Vector): Vector +{static} cross(v1: Vector, v2: Vector): Vector } interface Ray { +start: Vector +dir: Vector } interface Intersection { +thing: Thing +ray: Ray +dist: number } class Color { +r: number +g: number +b: number +{static} scale(k: number, v: Color): Color +{static} plus(v1: Color, v2: Color): Color +{static} times(v1: Color, v2: Color): Color +{static} white: Color +{static} grey: Color +{static} black: Color +{static} background: Color +{static} defaultColor: Color +{static} toDrawingColor(c: Color): { r: number; g: number; b: number; } } interface Surface { +diffuse: (pos: Vector) => Color +specular: (pos: Vector) => Color +reflect: (pos: Vector) => number +roughness: number } interface Thing { +intersect: (ray: Ray) => Intersection +normal: (pos: Vector) => Vector +surface: Surface +destroy(): void +destroy(name: string): void } interface Light { +pos: Vector +color: Color } class Camera { +forward: Vector +right: Vector +up: Vector +pos: Vector } interface Scene { +things: Thing[] +lights: Light[] +camera: Camera } class Plane implements Thing { +normal: (pos: Vector) => Vector +intersect: (ray: Ray) => Intersection +surface: Surface } class Sphere implements Thing { +radius2: number +center: Vector +surface: Surface +normal(pos: Vector): Vector +intersect(ray: Ray): { thing: this; ray: Ray; dist: number; } } namespace Surfaces { } class RayTracer { -maxDepth: number -intersections(ray: Ray, scene: Scene): Intersection -testRay(ray: Ray, scene: Scene): number -traceRay(ray: Ray, scene: Scene, depth: number): Color -shade(isect: Intersection, scene: Scene, depth: number): Color -getReflectionColor(thing: Thing, pos: Vector, normal: Vector, rd: Vector, scene: Scene, depth: number): Color -getNaturalColor(thing: Thing, pos: Vector, norm: Vector, rd: Vector, scene: Scene): any +render(scene: any, ctx: any, screenWidth: any, screenHeight: any): void } @enduml
Decode URL
Submit
amiga
aws-orange
black-knight
bluegray
blueprint
cerulean-outline
cerulean
crt-amber
crt-green
cyborg-outline
cyborg
hacker
lightgray
mars
materia-outline
materia
metal
mimeograph
minty
plain
reddress-darkblue
reddress-darkgreen
reddress-darkorange
reddress-darkred
reddress-lightblue
reddress-lightgreen
reddress-lightorange
reddress-lightred
sandstone
silver
sketchy-outline
sketchy
spacelab
spacelab-white
superhero-outline
superhero
toy
united
vibrant
🎉 Discover the future PlantUML Web Editor! 🚀
PNG
SVG
ASCII Art