SwiftyTwoLinks and KotlyOtlyDobleDosLinks
ContentView.swift
displays the 3D visualization of the double pendulum, and includes user controlsContentViewController.swift
controls the objects used to render in SceneKit, and updates simulation at 1/60 second incrementsTwoLinks.swift
models the physical behavior of the double pendulumTextSlider.swift
implements a slider control with a text label above it, with semi-transparent background
MainActivity.kt
is the layout and scene manipulation featuresMainViewModel.kt
controls resetting, pausing, or updating statesTwoLinks.kt
models the physical behavior of the double pendulum
There are five normalized values that define dimensions of the two link pendulum system.
Each link has a length L
, and a minimum distance d
from its end where an attachment point can be defined.
Three points are defined, the hinge point H
about which the link rotates, the link center point C
, and a pivot point P
about which a second link rotates.
The dimension x
defines the distance from H
to C
, and the dimension y
defines the distance from H
to P
.
The diagram below references these dimensions, and explains how they are calculated using normalized values that the user controls.