This is the verlet Reference Manual, version 0.0.8, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 07:03:57 2024 GMT+0.
verlet/verlet.asd
verlet/package.lisp
verlet/utility/algebra.lisp
verlet/utility/set.lisp
verlet/source/force.lisp
verlet/source/particle.lisp
verlet/source/physics-loop.lisp
verlet/source/spring/linear.lisp
verlet/source/spring/area.lisp
verlet/source/spring/volume.lisp
verlet/source/spring/force.lisp
verlet/source/modificator.lisp
verlet/source/damper.lisp
verlet/source/gravity/gravity.lisp
verlet/source/gravity/global.lisp
verlet/source/gravity/mutual.lisp
verlet/source/gravity/field.lisp
verlet/source/constraint/constraint.lisp
verlet/source/constraint/plane.lisp
verlet/source/constraint/sphere.lisp
verlet/source/constraint/triangle.lisp
verlet/source/friction/friction.lisp
verlet/source/friction/global.lisp
verlet/source/friction/field.lisp
verlet/source/friction/constraint.lisp
The main system appears first, followed by any subsystem dependency.
verlet
Verlet is a simple physics engine based on verlet
integration. It supports particles with position and direction, springs
between particles, global gravity as well as gravity between particles, and
spacial constraints.
Thomas Bartscher <thomas-bartscher@weltraumschlangen.de>
BSD-3
0.0.8
chain
(system).
metabang-bind
(system).
rtg-math
(system).
fset
(system).
mgl-pax
(system).
package.lisp
(file).
utility
(module).
source
(module).
Modules are listed depth-first from the system components tree.
verlet/utility
verlet/source
verlet/source/spring
verlet/source/gravity
verlet/source/constraint
verlet/source/friction
verlet/utility
package.lisp
(file).
verlet
(system).
algebra.lisp
(file).
set.lisp
(file).
verlet/source
package.lisp
(file).
utility
(module).
verlet
(system).
force.lisp
(file).
particle.lisp
(file).
physics-loop.lisp
(file).
spring
(module).
modificator.lisp
(file).
damper.lisp
(file).
gravity
(module).
constraint
(module).
friction
(module).
verlet/source/spring
force.lisp
(file).
particle.lisp
(file).
source
(module).
linear.lisp
(file).
area.lisp
(file).
volume.lisp
(file).
force.lisp
(file).
verlet/source/gravity
force.lisp
(file).
particle.lisp
(file).
modificator.lisp
(file).
source
(module).
gravity.lisp
(file).
global.lisp
(file).
mutual.lisp
(file).
field.lisp
(file).
verlet/source/constraint
force.lisp
(file).
particle.lisp
(file).
modificator.lisp
(file).
source
(module).
constraint.lisp
(file).
plane.lisp
(file).
sphere.lisp
(file).
triangle.lisp
(file).
verlet/source/friction
force.lisp
(file).
particle.lisp
(file).
source
(module).
friction.lisp
(file).
global.lisp
(file).
field.lisp
(file).
constraint.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
verlet/verlet.asd
verlet/package.lisp
verlet/utility/algebra.lisp
verlet/utility/set.lisp
verlet/source/force.lisp
verlet/source/particle.lisp
verlet/source/physics-loop.lisp
verlet/source/spring/linear.lisp
verlet/source/spring/area.lisp
verlet/source/spring/volume.lisp
verlet/source/spring/force.lisp
verlet/source/modificator.lisp
verlet/source/damper.lisp
verlet/source/gravity/gravity.lisp
verlet/source/gravity/global.lisp
verlet/source/gravity/mutual.lisp
verlet/source/gravity/field.lisp
verlet/source/constraint/constraint.lisp
verlet/source/constraint/plane.lisp
verlet/source/constraint/sphere.lisp
verlet/source/constraint/triangle.lisp
verlet/source/friction/friction.lisp
verlet/source/friction/global.lisp
verlet/source/friction/field.lisp
verlet/source/friction/constraint.lisp
verlet/package.lisp
verlet
(system).
@interface
(special variable).
@verlet
(special variable).
verlet/utility/algebra.lisp
utility
(module).
mirror
(function).
orthogonalize
(function).
project
(function).
towards
(function).
verlet/utility/set.lisp
verlet/source/force.lisp
source
(module).
deforce
(macro).
@force
(special variable).
find-force
(function).
force-dref
(class).
register-force
(function).
verlet/source/particle.lisp
source
(module).
[particle]
(function).
accelerate!
(function).
deflect!
(function).
mass<-
(reader method).
(setf mass<-)
(writer method).
particle
(class).
position<-
(method).
position<-
(reader method).
(setf position<-)
(writer method).
print-object
(method).
speed<-
(function).
update!
(generic function).
velocity<-
(function).
@particle
(special variable).
acceleration<-
(reader method).
(setf acceleration<-)
(writer method).
actual-previous-position<-
(reader method).
(setf actual-previous-position<-)
(writer method).
apply-force!
(function).
center-of-mass
(function).
next-position
(function).
previous-delta<-
(reader method).
(setf previous-delta<-)
(writer method).
previous-position<-
(reader method).
(setf previous-position<-)
(writer method).
temp-velocity<-
(reader method).
(setf temp-velocity<-)
(writer method).
verlet/source/physics-loop.lisp
force.lisp
(file).
source
(module).
[system]
(function).
build-system
(macro).
collisions<-
(reader method).
(setf collisions<-)
(writer method).
constraints<-
(reader method).
(setf constraints<-)
(writer method).
forces<-
(reader method).
(setf forces<-)
(writer method).
particles<-
(reader method).
(setf particles<-)
(writer method).
step!
(function).
system
(class).
velocity-dependent-forces<-
(reader method).
(setf velocity-dependent-forces<-)
(writer method).
@physics-system
(special variable).
verlet/source/spring/linear.lisp
spring
(module).
[spring]
(function).
k<-
(reader method).
(setf k<-)
(writer method).
length<-
(reader method).
(setf length<-)
(writer method).
spring
(class).
update!
(method).
@linear-spring
(special variable).
@spring
(special variable).
p1<-
(reader method).
p2<-
(reader method).
verlet/source/spring/area.lisp
spring
(module).
[area-spring]
(function).
area-spring
(class).
area<-
(reader method).
(setf area<-)
(writer method).
k<-
(reader method).
(setf k<-)
(writer method).
update!
(method).
@area-spring
(special variable).
p1<-
(reader method).
p2<-
(reader method).
p3<-
(reader method).
verlet/source/spring/volume.lisp
spring
(module).
[volume-spring]
(function).
k<-
(reader method).
(setf k<-)
(writer method).
update!
(method).
volume-spring
(class).
volume<-
(reader method).
(setf volume<-)
(writer method).
@volume-spring
(special variable).
p1<-
(reader method).
p2<-
(reader method).
p3<-
(reader method).
p4<-
(reader method).
verlet/source/spring/force.lisp
linear.lisp
(file).
area.lisp
(file).
volume.lisp
(file).
spring
(module).
verlet/source/modificator.lisp
particle.lisp
(file).
source
(module).
add-subject
(generic function).
modificator
(class).
remove-subject
(generic function).
@modificator
(special variable).
subjects<-
(reader method).
(setf subjects<-)
(writer method).
verlet/source/damper.lisp
force.lisp
(file).
particle.lisp
(file).
modificator.lisp
(file).
source
(module).
[damper]
(function).
d<-
(reader method).
(setf d<-)
(writer method).
damper
(class).
update!
(method).
@damper
(special variable).
verlet/source/gravity/gravity.lisp
verlet/source/gravity/global.lisp
gravity
(module).
[global-gravity]
(function).
global-gravity
(class).
update!
(method).
@global-gravity
(special variable).
gravity<-
(reader method).
(setf gravity<-)
(writer method).
verlet/source/gravity/mutual.lisp
gravity
(module).
[mutual-gravity]
(function).
mutual-gravity
(class).
update!
(method).
@mutual-gravity
(special variable).
verlet/source/gravity/field.lisp
gravity
(module).
[field-gravity]
(function).
field-gravity
(class).
field<-
(reader method).
(setf field<-)
(writer method).
update!
(method).
@field-gravity
(special variable).
verlet/source/constraint/constraint.lisp
constraint
(module).
constraint
(class).
deflection-vector
(generic function).
update!
(method).
violated?
(generic function).
@constraint
(special variable).
verlet/source/constraint/plane.lisp
constraint.lisp
(file).
constraint
(module).
[plane-constraint]
(function).
deflection-vector
(method).
plane-constraint
(class).
violated?
(method).
@plane-constraint
(special variable).
normal<-
(reader method).
point<-
(reader method).
verlet/source/constraint/sphere.lisp
constraint.lisp
(file).
constraint
(module).
[sphere-constraint]
(function).
deflection-vector
(method).
sphere-constraint
(class).
violated?
(method).
@sphere-constraint
(special variable).
center<-
(reader method).
outer-wall?
(reader method).
radius<-
(reader method).
verlet/source/constraint/triangle.lisp
constraint.lisp
(file).
constraint
(module).
[triangle-constraint]
(function).
deflection-vector
(method).
triangle-constraint
(class).
violated?
(method).
@triangle-constraint
(special variable).
p1<-
(reader method).
p2<-
(reader method).
p3<-
(reader method).
verlet/source/friction/friction.lisp
friction
(module).
friction!
(function).
@friction
(special variable).
verlet/source/friction/global.lisp
friction.lisp
(file).
friction
(module).
[global-friction]
(function).
friction<-
(reader method).
(setf friction<-)
(writer method).
global-friction
(class).
update!
(method).
@global-friction
(special variable).
verlet/source/friction/field.lisp
friction.lisp
(file).
friction
(module).
[field-friction]
(function).
field-friction
(class).
field<-
(reader method).
(setf field<-)
(writer method).
update!
(method).
@field-friction
(special variable).
verlet/source/friction/constraint.lisp
friction.lisp
(file).
friction
(module).
[constraint-friction]
(function).
constraint-friction
(class).
friction<-
(reader method).
(setf friction<-)
(writer method).
update!
(method).
@constraint-friction
(special variable).
constraint<-
(reader method).
Packages are listed by definition order.
verlet
chain
.
common-lisp
.
metabang.bind
.
mgl-pax
.
rtg-math
.
[area-spring]
(function).
[constraint-friction]
(function).
[damper]
(function).
[field-friction]
(function).
[field-gravity]
(function).
[global-friction]
(function).
[global-gravity]
(function).
[mutual-gravity]
(function).
[particle]
(function).
[plane-constraint]
(function).
[sphere-constraint]
(function).
[spring]
(function).
[system]
(function).
[triangle-constraint]
(function).
[volume-spring]
(function).
accelerate!
(function).
add-subject
(generic function).
area-spring
(class).
area<-
(generic reader).
(setf area<-)
(generic writer).
build-system
(macro).
collisions<-
(generic reader).
(setf collisions<-)
(generic writer).
constraint
(class).
constraint-friction
(class).
constraints<-
(generic reader).
(setf constraints<-)
(generic writer).
d<-
(generic reader).
(setf d<-)
(generic writer).
damper
(class).
deflect!
(function).
deflection-vector
(generic function).
deforce
(macro).
field-friction
(class).
field-gravity
(class).
field<-
(generic reader).
(setf field<-)
(generic writer).
forces<-
(generic reader).
(setf forces<-)
(generic writer).
friction!
(function).
friction<-
(generic reader).
(setf friction<-)
(generic writer).
global-friction
(class).
global-gravity
(class).
k<-
(generic reader).
(setf k<-)
(generic writer).
length<-
(generic reader).
(setf length<-)
(generic writer).
mass<-
(generic reader).
(setf mass<-)
(generic writer).
modificator
(class).
mutual-gravity
(class).
particle
(class).
particles<-
(generic reader).
(setf particles<-)
(generic writer).
plane-constraint
(class).
position<-
(generic function).
(setf position<-)
(generic writer).
remove-subject
(generic function).
speed<-
(function).
sphere-constraint
(class).
spring
(class).
step!
(function).
system
(class).
triangle-constraint
(class).
update!
(generic function).
velocity-dependent-forces<-
(generic reader).
(setf velocity-dependent-forces<-)
(generic writer).
velocity<-
(function).
violated?
(generic function).
volume-spring
(class).
volume<-
(generic reader).
(setf volume<-)
(generic writer).
@area-spring
(special variable).
@constraint
(special variable).
@constraint-friction
(special variable).
@damper
(special variable).
@field-friction
(special variable).
@field-gravity
(special variable).
@force
(special variable).
@friction
(special variable).
@global-friction
(special variable).
@global-gravity
(special variable).
@gravity
(special variable).
@interface
(special variable).
@linear-spring
(special variable).
@modificator
(special variable).
@mutual-gravity
(special variable).
@particle
(special variable).
@physics-system
(special variable).
@plane-constraint
(special variable).
@sphere-constraint
(special variable).
@spring
(special variable).
@triangle-constraint
(special variable).
@verlet
(special variable).
@volume-spring
(special variable).
acceleration<-
(generic reader).
(setf acceleration<-)
(generic writer).
actual-previous-position<-
(generic reader).
(setf actual-previous-position<-)
(generic writer).
apply-force!
(function).
center-of-mass
(function).
center<-
(generic reader).
constraint<-
(generic reader).
find-force
(function).
force-dref
(class).
gravity<-
(generic reader).
(setf gravity<-)
(generic writer).
mirror
(function).
next-position
(function).
normal<-
(generic reader).
orthogonalize
(function).
outer-wall?
(generic reader).
p1<-
(generic reader).
p2<-
(generic reader).
p3<-
(generic reader).
p4<-
(generic reader).
point<-
(generic reader).
previous-delta<-
(generic reader).
(setf previous-delta<-)
(generic writer).
previous-position<-
(generic reader).
(setf previous-position<-)
(generic writer).
project
(function).
radius<-
(generic reader).
register-force
(function).
subjects<-
(generic reader).
(setf subjects<-)
(generic writer).
temp-velocity<-
(generic reader).
(setf temp-velocity<-)
(generic writer).
towards
(function).
union*
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Build up a standard physics SYSTEM using defined forces.
PARTICLES is a list with items of the form
‘((X Y Z) &KEY (MASS 1.0) PREVIOUS-POSITION VELOCITY)‘.
The list at the beginning describes the position of the particle, for the
meaning of the keyword arguments reference the ‘[PARTICLE]‘ function.
FORCES is a list of force descriptors, as defined by the DEFORCE macro. The respective forces are going to be added to the final system.
Define a force so it is usable in the BUILD-SYSTEM macro.
MODE is required to be one of :FORCE, :VELOCITY-DEPENDENT-FORCE, :CONSTRAINT,
and :COLLISION. Reference the STEP! function for more information on what these
mean.
The LAMBDA-LIST is tha lambda list used by the local macro in the BUILD-SYSTEM macro call, BODY is it’s body. The resulting code should return the object to add to the system under construction. PARTICLES is an anaphoric variable in the BODY, containing a list of the particles defined by PARTICLES in the BUILD-SYSTEM macro, in the order they are defined in.
Creates an AREA-SPRING with corners P1, P2 and P3, ideal area AREA, and spring constant K. AREA defaults to the area enclosed by the supplied particles.
Creates CONSTRAINT-FRICTION which applies friction FRICTION to subjects on collision with CONSTRAINT. Note that the subject of the CONSTRAINT-FRICTION instance and of the constraint need not necessarily be the same.
Creates [FIELD-FRICTION][class] with friction field FIELD. FIELD must map 3D positions to friction values.
Creates [FIELD-GRAVITY][class] with gravity field FIELD. FIELD must map positions ‘(SIMPLE-ARRAY SINGLE-FLOAT (3))‘s to gravity vectors ‘(SIMPLE-ARRAY SINGLE-FLOAT (3))‘.
Creates an instance of [GLOBAL-GRAVITY][class] which accelerates all its subjects by GRAVITY on each frame.
Returns an instance of class PARTICLE at POSITION. Provide only one keyword argument among PREVIOUS-POSITION and VELOCITY, since the respective other is calculated from the provided. If none are provided, assume a velocity of 0.
Creates a [PLANE-CONSTRAINT][class] restricting all subjects to a half-space defined by the plane containing POINT with normal NORMAL. The usable half-space is the closed half-space that NORMAL is pointing into.
Creates a [SPHERE-CONSTRAINT][class] with center CENTER and radius
RADIUS. CENTER is a ‘(SIMPLE-ARRAY SINGLE-FLOAT (3))‘, RADIUS a
SINGLE-FLOAT. When OUTER-WALL? is truthy, movement is restricted to the closed
ball described by the sphere, otherwise movement is constricted to the outside
of the open ball described by the sphere.
Create a [SPRING][class] connecting the ‘PARTICLE‘s P1 and P2, with ideal length LENGTH and spring constant K. LENGTH defaults to the distance between P1 and P2.
Create a [TRIANGLE-CONSTRAINT][class] preventing particles moving through the triangle enclosed by P1, P2, and P3
Create a VOLUME-SPRING with corners P1, P2, P3 and P4, ideal volume VOLUME, and spring constant K. VOLUME defaults to the volume enclosed by the given particles.
Moves PARTICLE to TARGET and mirrors the PARTICLE’s velocity on the plane containing TARGET with the change in position as normal.
Reduce the speed of PARTICLE by FRICTION·DELTA to a minimum of speed 0. This means that the PARTICLE’s velocity’s direction is never reversed by this function. Modifies PARTICLE.
Return the speed of PARTICLE as a SINGLE-FLOAT.
Please note that this is a best guess at the current speed, based on the forces applied so far in the current frame.
Updates a physical SYSTEM by timestep DELTA.
1. Apply all forces not dependent on the velocity of particles (:FORCE in the
DEFORCE macro)
2. Calculate forces depending on velocities of particles, using the memoized
velocities so far (:VELOCITY-DEPENDENT-FORCE in the DEFORCE macro)
3. Repeat RESOLVE-STEPS times:
1. Resolve all static constraints (:CONSTRAINT in the DEFORCE macro)
2. Resolve collisions (:COLLISION in the DEFORCE macro)
Please note after STEP! returns, no collisions should be happening, but static constraints might be violated.
Return the velocity of PARTICLE as a ‘(SIMPLE-ARRAY SINGLE-FLOAT (3))‘.
Please note that this is a best guess at the current velocity, based on the forces applied so far in the current frame.
Adds a SUBJECT to the MODIFICATOR for tracking.
modificator
) (subject particle
)) ¶area-spring
)) ¶automatically generated reader method
area-spring
)) ¶automatically generated writer method
Returns the cange in position for PARTICLE to obey CONSTRAINT again.
triangle-constraint
) (particle particle
)) ¶sphere-constraint
) (particle particle
)) ¶plane-constraint
) (particle particle
)) ¶field-friction
)) ¶automatically generated reader method
field-gravity
)) ¶automatically generated reader method
field-friction
)) ¶automatically generated writer method
field-gravity
)) ¶automatically generated writer method
constraint-friction
)) ¶automatically generated reader method
global-friction
)) ¶automatically generated reader method
constraint-friction
)) ¶automatically generated writer method
global-friction
)) ¶automatically generated writer method
volume-spring
)) ¶automatically generated reader method
%k
.
area-spring
)) ¶automatically generated reader method
volume-spring
)) ¶automatically generated writer method
%k
.
area-spring
)) ¶automatically generated writer method
Remove a SUBJECT to the MODIFICATOR so it won’t be tracked anymore.
modificator
) (subject particle
)) ¶constraint-friction
) &optional delta) ¶field-friction
) &optional delta) ¶global-friction
) &optional delta) ¶Apply the global friction to all subjects.
constraint
) &optional delta) ¶Deflects all subjects violating the constraint as per VIOLATED? by the vector defined by DEFLECTION-VECTOR.
field-gravity
) &optional delta) ¶mutual-gravity
) &optional delta) ¶global-gravity
) &optional delta) ¶Accelerate the subjects of GRAVITY by the gravity vector.
volume-spring
) &optional delta) ¶Exert a volume-restoring force on the corners of the volume spring.
area-spring
) &optional delta) ¶Exert an area-restoring force on the corners of the area spring
Returns NIL when the constraint is fulfilled and a truthy value otherwise.
triangle-constraint
) (particle particle
)) ¶sphere-constraint
) (particle particle
)) ¶plane-constraint
) (particle particle
)) ¶volume-spring
)) ¶automatically generated reader method
volume-spring
)) ¶automatically generated writer method
(setf d<-)
.
d<-
.
update!
.
(function ((simple-array single-float (3))) (single-float 0.0))
:field
(function ((simple-array single-float (3))) (simple-array single-float (3)))
:field
(single-float (0.0))
:friction
(simple-array single-float (3))
:gravity
MODIFICATOR objects keep track of other objects to modify in a uniform fashion. The MODIFICATOR class itself is not meant to be instanciated. An inheriting class should implement a method for UPDATE! to make use of its subjects.
fset:set
(fset:set)
Applies gravitational force to the tracked particles according to the mass of the other tracked particles.
(setf acceleration<-)
.
acceleration<-
.
(setf actual-previous-position<-)
.
actual-previous-position<-
.
add-subject
.
deflection-vector
.
deflection-vector
.
deflection-vector
.
(setf mass<-)
.
mass<-
.
(setf position<-)
.
position<-
.
(setf previous-delta<-)
.
previous-delta<-
.
(setf previous-position<-)
.
previous-position<-
.
print-object
.
remove-subject
.
(setf temp-velocity<-)
.
temp-velocity<-
.
update!
.
violated?
.
violated?
.
violated?
.
(simple-array single-float (3))
:position
(simple-array single-float (3))
(rtg-math.base-vectors:v! 0 0 0)
(simple-array single-float (3))
(rtg-math.base-vectors:v! 0 0 0)
(simple-array single-float (3))
:previous-position
(real (0))
1.0
(simple-array single-float (3))
:actual-previous-position
(single-float (0.0))
:mass
(simple-array single-float (3))
:point
This slot is read-only.
(simple-array single-float (3))
:center
This slot is read-only.
(single-float (0.0))
:radius
This slot is read-only.
boolean
:outer-wall?
This slot is read-only.
(setf k<-)
.
k<-
.
(setf length<-)
.
length<-
.
p1<-
.
p2<-
.
update!
.
(single-float 0.0)
:length
fset:set
(fset:set)
fset:set
(fset:set)
fset:set
(fset:set)
fset:set
(fset:set)
fset:set
(fset:set)
sphere-constraint
)) ¶automatically generated reader method
constraint-friction
)) ¶automatically generated reader method
global-gravity
)) ¶automatically generated reader method
global-gravity
)) ¶automatically generated writer method
plane-constraint
)) ¶automatically generated reader method
sphere-constraint
)) ¶automatically generated reader method
triangle-constraint
)) ¶automatically generated reader method
%p1
.
volume-spring
)) ¶automatically generated reader method
%p1
.
area-spring
)) ¶automatically generated reader method
triangle-constraint
)) ¶automatically generated reader method
%p2
.
volume-spring
)) ¶automatically generated reader method
%p2
.
area-spring
)) ¶automatically generated reader method
triangle-constraint
)) ¶automatically generated reader method
%p3
.
volume-spring
)) ¶automatically generated reader method
%p3
.
area-spring
)) ¶automatically generated reader method
volume-spring
)) ¶automatically generated reader method
%p4
.
plane-constraint
)) ¶automatically generated reader method
sphere-constraint
)) ¶automatically generated reader method
modificator
)) ¶automatically generated reader method
modificator
)) ¶automatically generated writer method
Jump to: | (
[
A B C D F G K L M N O P R S T U V |
---|
Jump to: | (
[
A B C D F G K L M N O P R S T U V |
---|
Jump to: | %
@
S |
---|
Jump to: | %
@
S |
---|
Jump to: | A C D F G L M P S T U V |
---|
Jump to: | A C D F G L M P S T U V |
---|