Skip to content

Commit

Permalink
remove color and stable universes
Browse files Browse the repository at this point in the history
  • Loading branch information
lounsbrough committed Aug 22, 2024
1 parent a6dc577 commit e5abdee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 111 deletions.
13 changes: 5 additions & 8 deletions src/Body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ import Vector from './Vector'
export default class Body {
mass: number
radius: number
tailLength: number
color: string
position: Vector
velocity: Vector
acceleration: Vector = new Vector(0, 0, 0)
externalForces: Vector[] = []
netExternalForce: Vector = new Vector(0, 0, 0)
pastPositionsLength: number
pastPositions: Vector[] = []
maxVelocity: number | undefined

constructor({ mass, radius, position, velocity, color, tailLength, maxVelocity }: {
constructor({ mass, radius, position, velocity, pastPositionsLength, maxVelocity }: {
mass?: number
radius?: number
position: Vector
velocity: Vector
color?: string
tailLength?: number
pastPositionsLength?: number
maxVelocity?: number
}) {
if (mass === 0) {
Expand All @@ -28,9 +26,8 @@ export default class Body {

this.mass = mass ?? 1000000
this.radius = radius ?? 0.04
this.tailLength = tailLength ?? 200
this.color = color ?? '#000'
this.position = position
this.pastPositionsLength = pastPositionsLength ?? 200
this.pastPositions.push(position)
this.velocity = velocity
this.maxVelocity = maxVelocity
Expand Down Expand Up @@ -58,7 +55,7 @@ export default class Body {
}
const deltaPosition = this.velocity.scaleBy(deltaTime)
this.position = this.position.sum(deltaPosition)
if (this.pastPositions.length >= this.tailLength) {
if (this.pastPositions.length >= this.pastPositionsLength) {
this.pastPositions.pop()
}
this.pastPositions.unshift(this.position)
Expand Down
103 changes: 0 additions & 103 deletions src/StableUniverses.ts

This file was deleted.

0 comments on commit e5abdee

Please sign in to comment.