gts
Bindings for GNU Triangulated Surface (GTS) library.
TOC »
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
- matrix-new:: double * double * double * double * double * double * double * double * double * double * double * double * double * double * double * double => (nonnull-c-pointer GtsMatrix) procedure
Creates a new GTS 4x4 Matrix object and returns the pointer to it.
- matrix-assign:: (nonnull-c-pointer GtsMatrix) * double * double * double * double * double * double * double * double * double * double * double * double * double * double * double * double => void procedure
Sets the contents of an existing GTS Matrix object.
- matrix-destroy:: (nonnull-c-pointer GtsMatrix) => void procedure
Destroys a GTS Matrix object and frees the associated memory.
- matrix-zero:: (c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix) procedure
Sets a GTS Matrix object to the zero matrix (if the given matrix is NULL a new one is allocated).
- matrix-identity:: (c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix) procedure
Sets a GTS Matrix object to the identity matrix (if the given matrix is NULL a new one is allocated)
- matrix-transpose:: (nonnull-c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix) procedure
Transposes a GTS Matrix object and return the newly allocated matrix.
- matrix-inverse:: (nonnull-c-pointer GtsMatrix) => (c-pointer GtsMatrix) procedure
Inverts a GTS Matrix object and returns the newly allocated matrix or NULL if the matrix can't be inverted.
- matrix-product:: (nonnull-c-pointer GtsMatrix) * (nonnull-c-pointer GtsMatrix) => (nonnull-c-pointer GtsMatrix) procedure
Calculates the product of two matrices and return the newly allocated matrix.
- matrix-scale:: (c-pointer GtsMatrix) * f64vector => (nonnull-c-pointer GtsMatrix) procedure
Scales a GTS Matrix object in place.
- matrix-translate:: (c-pointer GtsMatrix) * f64vector => (nonnull-c-pointer GtsMatrix) procedure
Translates the GTS Matrix object by the given SRFI-4 f64vector object (if the matrix is NULL a new one is allocated and translated).
- matrix-rotate:: (c-pointer GtsMatrix) * f64vector * double => (nonnull-c-pointer GtsMatrix) procedure
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
- default-triangle-class :: void => (nonnull-c-pointer GtsTriangleClass) procedure
Default class descriptor for the GTS Triangle class (used by the triangle constructors below).
- triangle-enclosing:: (nonnull-c-pointer GtsTriangleClass) * (nonnull-c-pointer g_slist) * double => (nonnull-c-pointer GtsTriangle) procedure
Creates a GTS Triangle object that is guaranteed to enclose all the points in the list.
- triangle-new :: (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) => (nonnull-c-pointer GtsTriangle) procedure
Creates a new GTS Triangle object from 3 edges.
- triangle-set :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) * (nonnull-c-pointer GtsEdge) => void procedure
Discards the existing edges of the given GTS Triangle object and replaces them with the new ones.
- triangle-area :: (nonnull-c-pointer GtsTriangle) => double procedure
Computes the area of the given triangle.
- triangle-perimeter :: (nonnull-c-pointer GtsTriangle) => double procedure
Computes the perimeter of the given triangle.
- triangle-quality :: (nonnull-c-pointer GtsTriangle) => double procedure
Computes a measure of the quality of the given triangle (how close to equilateral it is).
- triangle-normal :: (nonnull-c-pointer GtsTriangle) => f64vector procedure
Computes the normal to the plane of the given triangle.
- triangle-revert :: (nonnull-c-pointer GtsTriangle) => void procedure
Changes the orientation of the given triangle, turning it inside out.
- triangle-orientation :: (nonnull-c-pointer GtsTriangle) => double procedure
Checks for the orientation of the plane (x,y) projection of the given triangle.
- triangle-vertices-edges :: (nonnull-c-pointer GtsTriangle) * (c-pointer GtsEdge) => vertices-vector * edges-vector procedure
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.
- triangle-vertices :: (nonnull-c-pointer GtsTriangle) * (c-pointer GtsEdge) => vector procedure
Returns a vector containing the vertices of the given triangle.
- triangle-vertex-opposite :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsEdge) => (nonnull-c-pointer GtsVertex) procedure
Returns a vertex of the given triangle that does not belong to the given edge.
- triangle-edge-opposite :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsVertex) => (nonnull-c-pointer GtsEdge) procedure
Returns the edge of the given triangle opposite to the given vertex.
- triangle-is-ok :: (nonnull-c-pointer GtsTriangle) => bool procedure
Returns true if the given triangle is non-degenerate, non-duplicate triangle, false otherwise.
- triangle-circumcircle-center :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsPointClass) => (nonnull-c-pointer GtsPoint) procedure
Returns the center of the circumscribing circle of the given triangle.
- triangle-interpolate-height :: (nonnull-c-pointer GtsTriangle) * (nonnull-c-pointer GtsPoint) => void procedure
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.
- triangles-from-edges :: (nonnull-c-pointer g_slist) => (nonnull-c-pointer g_slist) procedure
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
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/>.