This is the rectangle-packing Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 08 19:28:08 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
rectangle-packing
Code to pack rectangles into a bigger rectangle. Useful for texture packing for OpenGL.
Willem Rein Oudshoorn <woudshoo@xs4all.nl>
LLGPL, but I am flexible, ask me if you want something else.
1.0.0
package.lisp
(file).
rectangle-packing.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
rectangle-packing/rectangle-packing.asd
rectangle-packing/package.lisp
rectangle-packing/rectangle-packing.lisp
rectangle-packing/rectangle-packing.asd
rectangle-packing
(system).
rectangle-packing/rectangle-packing.lisp
package.lisp
(file).
rectangle-packing
(system).
pack-rectangles
(function).
pack-rectangles-tree
(function).
rectangle-tree-to-rectangle-list
(function).
sort-rectangles-on-size
(function).
tree-utilized-size
(function).
write-html
(function).
*size*
(special variable).
content
(reader method).
(setf content)
(writer method).
decision
(class).
dimension
(generic function).
empty-target-p
(generic function).
high
(reader method).
(setf high)
(writer method).
hv
(generic function).
insert-rectangle
(method).
left-child
(reader method).
(setf left-child)
(writer method).
low
(reader method).
(setf low)
(writer method).
lv
(generic function).
node
(class).
placed-rectangle-p
(generic function).
rectangle
(reader method).
(setf rectangle)
(writer method).
rectangle-fits
(generic function).
right-child
(reader method).
(setf right-child)
(writer method).
split-node
(function).
split-node-once
(function).
split-var
(reader method).
(setf split-var)
(writer method).
target-rectangle
(class).
translate
(function).
walk-tree-pre-order
(generic function).
write-svg-element
(generic function).
Packages are listed by definition order.
rectangle-packing
common-lisp
.
pack-rectangles
(function).
pack-rectangles-tree
(function).
rectangle-tree-to-rectangle-list
(function).
sort-rectangles-on-size
(function).
tree-utilized-size
(function).
write-html
(function).
*size*
(special variable).
content
(generic reader).
(setf content)
(generic writer).
decision
(class).
dimension
(generic function).
empty-target-p
(generic function).
high
(generic reader).
(setf high)
(generic writer).
hv
(generic function).
insert-rectangle
(generic function).
left-child
(generic reader).
(setf left-child)
(generic writer).
low
(generic reader).
(setf low)
(generic writer).
lv
(generic function).
node
(class).
placed-rectangle-p
(generic function).
rectangle
(generic reader).
(setf rectangle)
(generic writer).
rectangle-fits
(generic function).
right-child
(generic reader).
(setf right-child)
(generic writer).
split-node
(function).
split-node-once
(function).
split-var
(generic reader).
(setf split-var)
(generic writer).
target-rectangle
(class).
translate
(function).
walk-tree-pre-order
(generic function).
write-svg-element
(generic function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Takes a list of rectangles, where each rectangle
is specified as (width height . rest).
The size argument specifies the size of the target rectangle.
Returns a list of (x y orientation . rectangle)
Where rectangle is one of the argument rectangles
and orientation is either :0 or :90 (when it is rotated).
The location of the rectangles is given by ’x’ and ’y’.
Note that if not all rectangles can be placed, they will be silently
dropped from the packing and from the output.
To see which rectangles are packed you can use
(mapcar (pack-rectangles ...) #’cdddr)
NOTE: See also the note on the sort order of the rectangles in the
function ‘pack-rectangles-tree’
Takes a list of rectangles, where each rectangle
is specified as (width height . rest).
Returns a tree containing the pack information.
The size parameter is a list of the form (width height . rest) and
this specifies size of the target rectangle in which all the rectangles are packed.
If some rectangles do not fit they are silently skipped. To see if
the rectangles are skipped you have to call
‘rectangle-tree-to-rectangle-list’ and compare the length of the
resulting list.
NOTE: This function tries to pack the rectangles one by one.
So the sort order can have a huge impact on the efficiency
of the packing.
Experience has shown that in practice it is good idea to
sort the rectangles on size (the area). With the largest
rectangles first.
Takes a rectangle tree as returned by ‘pack-rectangles-tree’ as argument and returns
the packed rectangles as a list.
Each item of the list is rectangle, specified as (x y orientation . rectangle)
where ’rectangle’ is one of the original inputed rectangle.
The location of the packed rectangle is given by ’x’ and ’y’.
Orientation is either :0 or :90 depending if the rectangle is placed as given, or rotated. Note that the current algorithm does not use rotation and will always have :0 as orientation.
Sort the ‘rectangles’ form largest to smalles area.
This operation is non-destructive and for the format of the ‘rectangles’ argument
see ‘pack-rectangles’.
Returns the minimum enclosing rectangle of the rectangle tree ‘node’.
If the ‘node’ is created with ‘pack-rectangles-tree’ the result is
guarenteed (with restrictions, see the ‘pack-rectangles-tree’ function)
to fit in the given size.
However it is of course possible that the packing does not use the whole rectangle. This function returns the smallest enclosing rectangle for the packing.
The return value is a list of two elements:
(width height)
Writes a packing tree to an html file so the packing can be previewd.
The red rectangles are placed, the blue is empty space.
See ‘pack-rectangles-tree’ for how to create a packing tree.
Node needs to be a target-rectangle and rectangle
needs to fit inside this rectangle.
This function will change:
node ... (target-rectangle)
==>
node ... (decision)
/
/ node ... (target-rectangle)
/
node ... (decision)
/
/ node ... (target-rectangle)
/
node ... (target-rectangle = rectangle)
Replaces the target node node
with a decision node with two target node children.
target-rectangle
) var) ¶list
) var) ¶target-rectangle
)) ¶target-rectangle
)) ¶automatically generated reader method
high
.
target-rectangle
)) ¶automatically generated writer method
high
.
target-rectangle
)) ¶automatically generated reader method
low
.
target-rectangle
)) ¶automatically generated writer method
low
.
target-rectangle
)) ¶target-rectangle
)) ¶automatically generated reader method
target-rectangle
)) ¶automatically generated writer method
target-rectangle
) rectangle) ¶target-rectangle
)) ¶automatically generated reader method
target-rectangle
)) ¶automatically generated writer method
stream
) (rect target-rectangle
)) ¶(integer 0 1)
0
:split-var
:rectangle
Jump to: | (
C D E F G H I L M P R S T W |
---|
Jump to: | (
C D E F G H I L M P R S T W |
---|
Jump to: | *
C D H L R S |
---|
Jump to: | *
C D H L R S |
---|
Jump to: | C D F N P R S T |
---|
Jump to: | C D F N P R S T |
---|