# The cubic-bezier Reference Manual

## Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

# The cubic-bezier Reference Manual

This is the cubic-bezier Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 15:47:52 2021 GMT+0.

Next: , Previous: , Up: Top   [Contents][Index]

# cubic-bezier

A library for constructing and evaluating cubic Bézier curve paths.

## Install

``````(ql:quickload :cubic-bezier)
``````

## Usage

``````(make-curve points &key (divisions 100))
``````

Create a cubic Bézier curve path from the given sequence of `points`. `points` is a sequence of 3-dimensional vectors as constructed with `#'origin.vec3:vec`. `divisions` is the number of sub-divisions to use when estimating the arc-length of the curve path: see the documentation for `#'evaluate` for more information.

``````(add-points curve points)
``````

Append the specified `points` to `curve`. `points` should be a sequence of 3-dimensional vectors as constructed with `#'origin.vec3:vec`. NOTE: It is an error to add less than a segment worth of points. A cubic Bézier curve is defined by 4 points for the first segment, and three points for each successive segment (since the first point of a segment is shared with the last point of the previous segment.)

``````(edit-point curve index value)
``````

Edit the point of `curve` at index `index` with `value`. `value` should be a 3-dimensional vector as constructed with `#'origin.vec3:vec`.

``````(evaluate curve parameter &key even-spacing-p)
``````

Evaluate `curve` at parameter `parameter`. If `even-spacing-p` is non-NIL, arc-length re-parameterization is applied, which evenly spaces points along the curve. The number of points is defined by the `divisions` argument supplied when constructing the curve with `#'make-curve`. Arc-length re-parameterization is a remapping of `parameter` before evaluating the curve, in order to allow for uses such as animation along a curve with a constant velocity.

``````(point-count-valid-p point-count)
``````

Check whether the integer `point-count` is a valid number of points for a cubic Bézier curve path. To be valid, there must be at least 4 points, any increment of 3 thereafter: (4, 7, 10, 13, ...).

``````(point-index-present-p curve index)
``````

Check if `curve` has a point at index `index`.

``````(collect-points curve count &key even-spacing-p)
``````

Evaluate `count` points along curve, returning a list of 3-dimensional vectors. If `even-spacing-p` is supplied, arc-length re-parameterization is applied: see the documentation for `#'evaluate` for more information.

``````(collect-segments curve count &key even-spacing-p)
``````

Collect a list of `count` segments of `curve`. A segment is a list of two 3-dimensional vectors. If `even-spacing-p` is supplied, arc-length re-parameterization is applied: see the documentation for `#'evaluate` for more information.

## License

Copyright © Michael Fiano mail@mfiano.net.

Licensed under the MIT Lice

Next: , Previous: , Up: Top   [Contents][Index]

## 2 Systems

The main system appears first, followed by any subsystem dependency.

Previous: , Up: Systems   [Contents][Index]

### 2.1 cubic-bezier

Author

Michael Fiano <mail@mfiano.net>

Home Page
License

MIT

Description

A library for constructing and evaluating cubic Bézier curve paths.

Dependencies
• golden-utils
• origin
Source

cubic-bezier.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

## 3 Files

Files are sorted by type and then listed depth-first from the systems components trees.

Previous: , Up: Files   [Contents][Index]

### 3.1 Lisp

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.1 cubic-bezier.asd

Location

/home/quickref/quicklisp/dists/quicklisp/software/cubic-bezier-20210411-git/cubic-bezier.asd

Systems

cubic-bezier (system)

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.2 cubic-bezier/package.lisp

Parent

cubic-bezier (system)

Location

package.lisp

Packages

Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.3 cubic-bezier/cubic-bezier.lisp

Dependency

package.lisp (file)

Parent

cubic-bezier (system)

Location

cubic-bezier.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

## 4 Packages

Packages are listed by definition order.

Previous: , Up: Packages   [Contents][Index]

### 4.1 cubic-bezier

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

## 5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.

Next: , Previous: , Up: Definitions   [Contents][Index]

### 5.1 Exported definitions

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.1 Functions

Function: add-points CURVE POINTS

Append the specified ‘points‘ to ‘curve‘. ‘points‘ should be a sequence of 3-dimensional vectors as constructed with ‘#’origin.vec3:vec‘. NOTE: It is an error to add less than a segment worth of points. A cubic Bézier curve is defined by 4 points for the first segment, and three points for each successive segment (since the first point of a segment is shared with the last point of the previous segment.)

Package
Source

cubic-bezier.lisp (file)

Function: collect-points CURVE COUNT &key EVEN-SPACING-P

Evaluate ‘count‘ points along curve, returning a list of 3-dimensional vectors. If ‘even-spacing-p‘ is supplied, arc-length re-parameterization is applied: see the documentation for ‘#’evaluate‘ for more information.

Package
Source

cubic-bezier.lisp (file)

Function: collect-segments CURVE COUNT &key EVEN-SPACING-P

Collect a list of ‘count‘ segments of ‘curve‘. A segment is a list of two 3-dimensional vectors. If ‘even-spacing-p‘ is supplied, arc-length re-parameterization is applied: see the documentation for ‘#’evaluate‘ for more information.

Package
Source

cubic-bezier.lisp (file)

Function: edit-point CURVE INDEX VALUE

Edit the point of ‘curve‘ at index ‘index‘ with ‘value‘. ‘value‘ should be a 3-dimensional vector as constructed with ‘#’origin.vec3:vec‘.

Package
Source

cubic-bezier.lisp (file)

Function: evaluate CURVE PARAMETER &key EVEN-SPACING-P

Evaluate ‘curve‘ at parameter ‘parameter‘. If ‘even-spacing-p‘ is non-NIL, arc-length re-parameterization is applied, which evenly spaces points along the curve. The number of points is defined by the ‘divisions‘ argument supplied when constructing the curve with ‘#’make-curve‘. Arc-length re-parameterization is a remapping of ‘parameter‘ before evaluating the curve, in order to allow for uses such as animation along a curve with a constant velocity.

Package
Source

cubic-bezier.lisp (file)

Function: make-curve POINTS &key DIVISIONS

Create a cubic Bézier curve path from the given sequence of ‘points‘. ‘points‘ is a sequence of 3-dimensional vectors as constructed with ‘#’origin.vec3:vec‘. ‘divisions‘ is the number of sub-divisions to use when estimating the arc-length of the curve path: see the documentation for ‘#’evaluate‘ for more information.

Package
Source

cubic-bezier.lisp (file)

Function: point-count-valid-p POINT-COUNT

Check whether the integer ‘point-count‘ is a valid number of points for a cubic Bézier curve path. To be valid, there must be at least 4 points, any increment of 3 thereafter: (4, 7, 10, 13, ...).

Package
Source

cubic-bezier.lisp (file)

Function: point-index-present-p CURVE INDEX

Check if ‘curve‘ has a point at index ‘index‘.

Package
Source

cubic-bezier.lisp (file)

Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.2 Structures

Structure: curve ()
Package
Source

cubic-bezier.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: divisions
Type

fixnum

Initform

100

Readers

divisions (function)

Writers

(setf divisions) (function)

Slot: geometry
Type

vector

Initform

(make-array 0 :adjustable t :fill-pointer 0)

Readers

geometry (function)

Writers

(setf geometry) (function)

Slot: arc-lengths
Type

golden-utils:f32a

Initform

(golden-utils:make-f32-array 0)

Readers

arc-lengths (function)

Writers

(setf arc-lengths) (function)

Slot: arc-lengths-update
Type

boolean

Readers

arc-lengths-update (function)

Writers

(setf arc-lengths-update) (function)

Previous: , Up: Definitions   [Contents][Index]

### 5.2 Internal definitions

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.1 Constants

Constant: +matrix+
Package
Source

cubic-bezier.lisp (file)

Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.2 Functions

Function: %make-curve &key (DIVISIONS DIVISIONS) (GEOMETRY GEOMETRY) (ARC-LENGTHS ARC-LENGTHS) (ARC-LENGTHS-UPDATE ARC-LENGTHS-UPDATE)
Package
Source

cubic-bezier.lisp (file)

Function: add-geometry CURVE POINTS
Package
Source

cubic-bezier.lisp (file)

Function: arc-lengths INSTANCE
Function: (setf arc-lengths) VALUE INSTANCE
Package
Source

cubic-bezier.lisp (file)

Function: arc-lengths-update INSTANCE
Function: (setf arc-lengths-update) VALUE INSTANCE
Package
Source

cubic-bezier.lisp (file)

Function: divisions INSTANCE
Function: (setf divisions) VALUE INSTANCE
Package
Source

cubic-bezier.lisp (file)

Function: ensure-point-list POINTS
Package
Source

cubic-bezier.lisp (file)

Function: estimate-arc-lengths CURVE
Package
Source

cubic-bezier.lisp (file)

Function: geometry INSTANCE
Function: (setf geometry) VALUE INSTANCE
Package
Source

cubic-bezier.lisp (file)

Function: make-geometry CURVE POINTS
Package
Source

cubic-bezier.lisp (file)

Function: remap CURVE PARAMETER
Package
Source

cubic-bezier.lisp (file)

Function: verify-points POINTS
Package
Source

cubic-bezier.lisp (file)

Previous: , Up: Top   [Contents][Index]

## Appendix A Indexes

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.1 Concepts

Jump to: C   F   L
Jump to: C   F   L

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.2 Functions

Jump to: %   (   A   C   D   E   F   G   M   P   R   V
Jump to: %   (   A   C   D   E   F   G   M   P   R   V

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.3 Variables

Jump to: +   A   C   D   G   S
Jump to: +   A   C   D   G   S

Previous: , Up: Indexes   [Contents][Index]

### A.4 Data types

Jump to: C   P   S
Jump to: C   P   S