Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

gts

Bindings for GNU Triangulated Surface (GTS) library.

  1. Outdated egg!
  2. gts
  3. Usage
  4. Documentation
    1. File procedures
    2. Glib procedures
    3. Matrix procedures
    4. Point procedures
    5. Triangle procedures
  5. Examples
  6. About this egg
    1. Author
    2. Version history
    3. License

Usage

(require-extension gts)

Documentation

GTS is a library for constructing and manipulating triangulated surface meshes. The Chicken gts library provides bindings for the GTS API, as well as some additional convenience procedures.

File procedures

Glib procedures

Matrix procedures

[procedure] matrix-new:: double * double * double * double * double * double * double * double * double * double * double * double * double * double * double * double => (nonnull-c-pointer GtsMatrix)

Creates a new GTS 4x4 Matrix object and returns the pointer to it.

[procedure] matrix-assign:: (nonnull-c-pointer GtsMatrix) * double * double * double * double * double * double * double * double * double * double * double * double * double * double * double * double => void

Sets the contents of an existing GTS Matrix object.

[procedure] matrix-destroy:: (nonnull-c-pointer GtsMatrix) => void

Destroys a GTS Matrix object and frees the associated memory.

[procedure] matrix-zero:: (c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix)

Sets a GTS Matrix object to the zero matrix (if the given matrix is NULL a new one is allocated).

[procedure] matrix-identity:: (c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix)

Sets a GTS Matrix object to the identity matrix (if the given matrix is NULL a new one is allocated)

[procedure] matrix-transpose:: (nonnull-c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix)

Transposes a GTS Matrix object and return the newly allocated matrix.

[procedure] matrix-inverse:: (nonnull-c-pointer GtsMatrix) => (c-pointer GtsMatrix)

Inverts a GTS Matrix object and returns the newly allocated matrix or NULL if the matrix can't be inverted.

[procedure] matrix-product:: (nonnull-c-pointer GtsMatrix) * (nonnull-c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix)

Calculates the product of two matrices and return the newly allocated matrix.

[procedure] matrix-scale:: (c-pointer GtsMatrix) * f64vector => (nonnull-c-pointer GtsMatrix)

Scales a GTS Matrix object in place.

[procedure] matrix-translate:: (c-pointer GtsMatrix) * f64vector => (nonnull-c-pointer GtsMatrix)

Translates the GTS Matrix object by the given SRFI-4 f64vector object (if the matrix is NULL a new one is allocated and translated).

[procedure] matrix-rotate:: (c-pointer GtsMatrix) * f64vector * double => (nonnull-c-pointer GtsMatrix)

Rotates the GTS Matrix object around the give SRFI-4 f64vector by the given angle (if the matrix is NULL a new one is allocated and rotated).

Point procedures

Triangle procedures

[procedure] default-triangle-class :: void => (nonnull-c-pointer GtsTriangleClass)

Default class descriptor for the GTS Triangle class (used by the triangle constructors below).

[procedure] triangle-enclosing:: (nonnull-c-pointer GtsTriangleClass) * (nonnull-c-pointer g_slist) * double => (nonnull-c-pointer GtsTriangle)

Creates a GTS Triangle object that is guaranteed to enclose all the points in the list.

[procedure] triangle-new :: (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) => (nonnull-c-pointer GtsTriangle)

Creates a new GTS Triangle object from 3 edges.

[procedure] triangle-set :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) => void

Discards the existing edges of the given GTS Triangle object and replaces them with the new ones.

[procedure] triangle-area :: (nonnull-c-pointer GtsTriangle) => double

Computes the area of the given triangle.

[procedure] triangle-perimeter :: (nonnull-c-pointer GtsTriangle) => double

Computes the perimeter of the given triangle.

[procedure] triangle-quality :: (nonnull-c-pointer GtsTriangle) => double

Computes a measure of the quality of the given triangle (how close to equilateral it is).

[procedure] triangle-normal :: (nonnull-c-pointer GtsTriangle) => f64vector

Computes the normal to the plane of the given triangle.

[procedure] triangle-revert :: (nonnull-c-pointer GtsTriangle) => void

Changes the orientation of the given triangle, turning it inside out.

[procedure] triangle-orientation :: (nonnull-c-pointer GtsTriangle) => double

Checks for the orientation of the plane (x,y) projection of the given triangle.

[procedure] triangle-neighbors :: (nonnull-c-pointer GtsTriangle) => (nonnull-c-pointer g_slist)
[procedure] triangle-vertices-edges :: (nonnull-c-pointer GtsTriangle) * (c-pointer GtsEdge) => vertices-vector * edges-vector

Returns a pair of two vectors containing the vertices and edges of the given triangle, respectively. If the edge argument is not NULL, then it is identical to the first elements of the edges vector.

[procedure] triangle-vertices :: (nonnull-c-pointer GtsTriangle) * (c-pointer GtsEdge) => vector

Returns a vector containing the vertices of the given triangle.

[procedure] triangle-vertex-opposite :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsEdge) => (nonnull-c-pointer GtsVertex)

Returns a vertex of the given triangle that does not belong to the given edge.

[procedure] triangle-edge-opposite :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsVertex) => (nonnull-c-pointer GtsEdge)

Returns the edge of the given triangle opposite to the given vertex.

[procedure] triangle-is-ok :: (nonnull-c-pointer GtsTriangle) => bool

Returns true if the given triangle is non-degenerate, non-duplicate triangle, false otherwise.

[procedure] triangle-circumcircle-center :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsPointClass) => (nonnull-c-pointer GtsPoint)

Returns the center of the circumscribing circle of the given triangle.

[procedure] triangle-interpolate-height :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsPoint) => void

Fills the z-coordinate of the given point belonging to the plane projection of the given triangle with the linearly interpolated value of the z-coordinates of the vertices of the triangle.

[procedure] triangles-from-edges :: (nonnull-c-pointer g_slist) => (nonnull-c-pointer g_slist)

Returns a list of unique triangles which have one of their edges in the given list of edges.

Examples

(use gts)

(define s (cube))

(surface-rotate s dx: 1.0 dy: 1.0 dz: 1.0 angle: 45.0)

(let ((out (fopen "cube.gts" "w+")))

  (surface-write s out))

About this egg

Author

Ivan Raikov

Version history

1.4
Using pkg-config or gts-config to determine compilation flags
1.2
Additional flags for the surface intersection operation
1.0
Initial release

License

Copyright 2011-2012 Ivan Raikov and the Okinawa Institute of Science and Technology

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

A full copy of the GPL license can be found at
<http://www.gnu.org/licenses/>.