From 5faa868e12568f4525d032026f69268cc1328f1e Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 16 Sep 2024 01:11:47 +0000 Subject: [PATCH] build based on eceae05 --- previews/PR219/.documenter-siteinfo.json | 2 +- previews/PR219/api/index.html | 20 ++++++++++---------- previews/PR219/decomposition/index.html | 2 +- previews/PR219/index.html | 2 +- previews/PR219/meshes/index.html | 2 +- previews/PR219/polygons/index.html | 2 +- previews/PR219/primitives/index.html | 2 +- previews/PR219/static_array_types/index.html | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/previews/PR219/.documenter-siteinfo.json b/previews/PR219/.documenter-siteinfo.json index 6a1e66f4..c9f22830 100644 --- a/previews/PR219/.documenter-siteinfo.json +++ b/previews/PR219/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.7.3","generation_timestamp":"2024-09-15T23:50:17","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.7.3","generation_timestamp":"2024-09-16T01:11:41","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/previews/PR219/api/index.html b/previews/PR219/api/index.html index df23d31e..3fb39d53 100644 --- a/previews/PR219/api/index.html +++ b/previews/PR219/api/index.html @@ -1,17 +1,17 @@ -API Reference · GeometryBasics.jl

API Reference

Exports

GeometryBasics.AbstractFaceType
AbstractFace{N_indices, T} <: StaticVector{N_indices, T}

Parent type for all face types. The standard face type is typically a GLTriangleFace = NgonFace{3, GLIndex}.

source
GeometryBasics.AbstractMeshType
AbstractMesh

An abstract mesh is a collection of Polytope elements (Simplices / Ngons). The connections are defined via faces(mesh) and the coordinates of the elements are returned by coordinates(mesh).

source
GeometryBasics.CylinderType
Cylinder{T}(origin::Point3, extremity::Point3, radius)

A Cylinder is a 3D primitive defined by an origin, an extremity (end point) and a radius.

source
GeometryBasics.FaceViewType
FaceView(data, faces)

A FaceView is alternative to passing a vertex attribute directly to a mesh. It bundles data with a different set of faces which replace the default faces of a mesh. Doing this allows you to have the data in a different order from vertices in the mesh, potentially avoiding duplication.

You can get the data of a FaceView with values(faceview) and the faces with faces(faceview).

source
GeometryBasics.HyperRectangleType
HyperRectangle{N, T}

A HyperRectangle is a generalization of a rectangle into N-dimensions. Formally it is the cartesian product of intervals, which is represented by the origin and widths fields, whose indices correspond to each of the N axes.

source
GeometryBasics.HyperSphereType
HyperSphere{N, T}

A HyperSphere is a generalization of a sphere into N-dimensions. A center and radius, r, must be specified.

source
GeometryBasics.MatType
Mat{R, C, T, L} <: AbstractMatrix{T}

GeometryBasics type for statically sized matrices. R is the number of rows, C columns, T the eltype and L = R * C the total number of elements.

source
GeometryBasics.MatMethod
Mat{R, C, T[, L]}(args::Union{UniformScaling, Tuple, AbstractMatrix})
+API Reference · GeometryBasics.jl

API Reference

Exports

GeometryBasics.AbstractFaceType
AbstractFace{N_indices, T} <: StaticVector{N_indices, T}

Parent type for all face types. The standard face type is typically a GLTriangleFace = NgonFace{3, GLIndex}.

source
GeometryBasics.AbstractMeshType
AbstractMesh

An abstract mesh is a collection of Polytope elements (Simplices / Ngons). The connections are defined via faces(mesh) and the coordinates of the elements are returned by coordinates(mesh).

source
GeometryBasics.CylinderType
Cylinder{T}(origin::Point3, extremity::Point3, radius)

A Cylinder is a 3D primitive defined by an origin, an extremity (end point) and a radius.

source
GeometryBasics.FaceViewType
FaceView(data, faces)

A FaceView is alternative to passing a vertex attribute directly to a mesh. It bundles data with a different set of faces which replace the default faces of a mesh. Doing this allows you to have the data in a different order from vertices in the mesh, potentially avoiding duplication.

You can get the data of a FaceView with values(faceview) and the faces with faces(faceview).

source
GeometryBasics.HyperRectangleType
HyperRectangle{N, T}

A HyperRectangle is a generalization of a rectangle into N-dimensions. Formally it is the cartesian product of intervals, which is represented by the origin and widths fields, whose indices correspond to each of the N axes.

source
GeometryBasics.HyperSphereType
HyperSphere{N, T}

A HyperSphere is a generalization of a sphere into N-dimensions. A center and radius, r, must be specified.

source
GeometryBasics.MatType
Mat{R, C, T, L} <: AbstractMatrix{T}

GeometryBasics type for statically sized matrices. R is the number of rows, C columns, T the eltype and L = R * C the total number of elements.

source
GeometryBasics.MatMethod
Mat{R, C, T[, L]}(args::Union{UniformScaling, Tuple, AbstractMatrix})
 Mat{R, C}(args::Union{Tuple, AbstractMatrix})
-Mat{C}(args::Tuple)

Constructs a static Matrix from the given inputs. Can also take multiple numeric args. If only one size is given the matrix is assumed to be square.

Aliases

TFloat64Float32IntUInt
NMat{N,T}Matd{N}Matf{N}Mati{N}Matui{N}
2Mat2{T}Mat2dMat2fMat2iMat2ui
3Mat3{T}Mat3dMat3fMat3iMat3ui
source
GeometryBasics.MeshType
Mesh{D, T, FaceType, FaceArrayType} <: AbstractMesh{D, T} <: AbstractGeometry{D, T}

The type of a concrete mesh. It can hold arbitrary vertex data (including FaceView's).

source
GeometryBasics.MeshMethod
Mesh(faces[; views, attributes...])
+Mat{C}(args::Tuple)

Constructs a static Matrix from the given inputs. Can also take multiple numeric args. If only one size is given the matrix is assumed to be square.

Aliases

TFloat64Float32IntUInt
NMat{N,T}Matd{N}Matf{N}Mati{N}Matui{N}
2Mat2{T}Mat2dMat2fMat2iMat2ui
3Mat3{T}Mat3dMat3fMat3iMat3ui
source
GeometryBasics.MeshType
Mesh{D, T, FaceType, FaceArrayType} <: AbstractMesh{D, T} <: AbstractGeometry{D, T}

The type of a concrete mesh. It can hold arbitrary vertex data (including FaceView's).

source
GeometryBasics.MeshMethod
Mesh(faces[; views, attributes...])
 Mesh(positions, faces[; views])
 Mesh(positions, faces::AbstractVector{<: Integer}[; facetype = TriangleFace, skip = 1])
-Mesh(; attributes...)

Constructs a mesh from the given arguments.

If positions are given explicitly, they are merged with other vertex attributes under the name position. Otherwise they must be part of attributes. If faces are not given attributes.position must be a FaceView.

Any other vertex attribute can be either an AbstractVector or a FaceView thereof. Every vertex attribute that is an AbstractVector must be sufficiently large to be indexable by mesh.faces. Every vertex attribute that is a FaceView must contain similar faces to mesh.faces, i.e. contain the same number of faces and have faces of matching length.

views can be defined optionally to implicitly split the mesh into multi sub-meshes. This is done by providing ranges for indexing faces which correspond to the sub-meshes. By default this is left empty.

source
GeometryBasics.MetaMeshMethod
MetaMesh(mesh; metadata...)
-MetaMesh(positions, faces; metadata...)

Constructs a MetaMesh either from another mesh or by constructing another mesh with the given positions and faces. Any keyword arguments given will be stored in the meta field in MetaMesh.

This struct is meant to be used for storage of non-vertex data. Any vertex related data should be stored as a vertex attribute in Mesh.

The metadata added to the MetaMesh can be manipulated with Dict-like operations (getindex, setindex!, get, delete, keys, etc). Vertex attributes can be accessed via fields and the same getters as mesh. The mesh itself can be retrieved with Mesh(metamesh).

source
GeometryBasics.NgonFaceType
NgonFace{N, T}

A planar face connecting N vertices. Shorthands include:

  • LineFace{T} = NgonFace{2,T}
  • TriangleFace{T} = NgonFace{3,T}
  • QuadFace{T} = NgonFace{4,T}
  • GLTriangleFace = TriangleFace{GLIndex}
source
GeometryBasics.OffsetIntegerType
OffsetInteger{O, T}

OffsetInteger type mainly for indexing.

  • O - The offset relative to Julia arrays. This helps reduce copying when

communicating with 0-indexed systems such as OpenGL.

source
GeometryBasics.PointType
Point{N, T}(args...)
-Point{N, T}(args::Union{AbstractVector, Tuple, NTuple, StaticVector})

Constructs a Point of length N from the given arguments.

Note that Point and Vec don't follow strict mathematical definitions. Instead we allow them to be used interchangeably.

Aliases

TFloat64Float32IntUInt
NPoint{N,T}Pointd{N}Pointf{N}Pointi{N}Pointui{N}
2Point2{T}Point2dPoint2fPoint2iPoint2ui
3Point3{T}Point3dPoint3fPoint3iPoint3ui
source
GeometryBasics.PolygonType
Polygon(exterior::AbstractVector{<:Point})
-Polygon(exterior::AbstractVector{<:Point}, interiors::Vector{<:AbstractVector{<:Point}})

Constructs a polygon from a set of exterior points. If interiors are given, each of them cuts away from the Polygon.

source
GeometryBasics.PolytopeType
Polytope{Dim, T} <: AbstractGeometry{Dim, T}

A Polytope is the generalization of a Polygon to higher dimensions, i.e. a geometric object consisting of flat faces.

A Polygon and Ngon are both 2D Polytopes. A Simplex is the simplest Polytope in arbitrary dimensions.

source
GeometryBasics.PolytopeMethod
Polytope(::Type{<: Point}, ::Type{<: AbstractNgonFace})

The Ngon Polytope element type when indexing an array of points with a SimplexFace

source
GeometryBasics.PolytopeMethod
Polytope(::Type{Point{Dim,T}}, ::Type{<:AbstractSimplexFace{N}})

The Simplex Polytope element type when indexing an array of points with a SimplexFace

source
GeometryBasics.PolytopeMethod
Polytope(::Type{<:NSimplex{N}}, P::Type{Point{NDim,T}})

The fully concrete Simplex type, when constructed from a point type!

source
GeometryBasics.PolytopeMethod
Polytope(::Type{<: Ngon}, P::Type{<: Point})

The fully concrete Ngon type, when constructed from a point type!

source
GeometryBasics.PyramidType
Pyramid(middle::Point3, length::Real, width::Real)

A Pyramid is an axis-aligned primitive where the tip of the Pyramid extends by length from middle in z direction and the square base extends by width in ±x and ±y direction from middle.

source
GeometryBasics.RectType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectMethod
Rect(vals::Number...)
Rect(vals::Number...)

Rect constructor for individually specified intervals. e.g. Rect(0,0,1,2) has origin == Vec(0,0) and width == Vec(1,2)

source
GeometryBasics.RectMethod
Rect(points::AbstractArray{<: Point})

Construct a bounding box countaining all the given points.

source
GeometryBasics.Rect2Type
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect2dType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect2fType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect2iType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3Type
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3dType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3fType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3iType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectdType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectfType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectiType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.SimplexType
Simplex{D, T<:Real, N}(points::NTuple{N, Point{D, T}})

A Simplex is a generalization of an N-dimensional tetrahedra and can be thought of as a minimal convex set containing the specified points.

  • A 0-simplex is a point.
  • A 1-simplex is a line segment.
  • A 2-simplex is a triangle.
  • A 3-simplex is a tetrahedron.

Note that this datatype is offset by one compared to the traditional mathematical terminology. So a one-simplex is represented as Simplex{2,T}. This is for a simpler implementation.

It applies to infinite dimensions. The structure of this type is designed to allow embedding in higher-order spaces by parameterizing on T.

source
GeometryBasics.TesselationType
Tesselation(primitive, nvertices)

When generating a mesh from an abstract geometry, we can typically generate it at different levels of detail, i.e. with different amounts of vertices. The Tesselation wrapper allows you to specify this level of detail. When generating a mesh from a tesselated geometry, the added information will be passed to coordinates, faces, etc.

sphere = Sphere(Point3f(0), 1)
+Mesh(; attributes...)

Constructs a mesh from the given arguments.

If positions are given explicitly, they are merged with other vertex attributes under the name position. Otherwise they must be part of attributes. If faces are not given attributes.position must be a FaceView.

Any other vertex attribute can be either an AbstractVector or a FaceView thereof. Every vertex attribute that is an AbstractVector must be sufficiently large to be indexable by mesh.faces. Every vertex attribute that is a FaceView must contain similar faces to mesh.faces, i.e. contain the same number of faces and have faces of matching length.

views can be defined optionally to implicitly split the mesh into multi sub-meshes. This is done by providing ranges for indexing faces which correspond to the sub-meshes. By default this is left empty.

source
GeometryBasics.MetaMeshMethod
MetaMesh(mesh; metadata...)
+MetaMesh(positions, faces; metadata...)

Constructs a MetaMesh either from another mesh or by constructing another mesh with the given positions and faces. Any keyword arguments given will be stored in the meta field in MetaMesh.

This struct is meant to be used for storage of non-vertex data. Any vertex related data should be stored as a vertex attribute in Mesh.

The metadata added to the MetaMesh can be manipulated with Dict-like operations (getindex, setindex!, get, delete, keys, etc). Vertex attributes can be accessed via fields and the same getters as mesh. The mesh itself can be retrieved with Mesh(metamesh).

source
GeometryBasics.NgonFaceType
NgonFace{N, T}

A planar face connecting N vertices. Shorthands include:

  • LineFace{T} = NgonFace{2,T}
  • TriangleFace{T} = NgonFace{3,T}
  • QuadFace{T} = NgonFace{4,T}
  • GLTriangleFace = TriangleFace{GLIndex}
source
GeometryBasics.OffsetIntegerType
OffsetInteger{O, T}

OffsetInteger type mainly for indexing.

  • O - The offset relative to Julia arrays. This helps reduce copying when

communicating with 0-indexed systems such as OpenGL.

source
GeometryBasics.PointType
Point{N, T}(args...)
+Point{N, T}(args::Union{AbstractVector, Tuple, NTuple, StaticVector})

Constructs a Point of length N from the given arguments.

Note that Point and Vec don't follow strict mathematical definitions. Instead we allow them to be used interchangeably.

Aliases

TFloat64Float32IntUInt
NPoint{N,T}Pointd{N}Pointf{N}Pointi{N}Pointui{N}
2Point2{T}Point2dPoint2fPoint2iPoint2ui
3Point3{T}Point3dPoint3fPoint3iPoint3ui
source
GeometryBasics.PolygonType
Polygon(exterior::AbstractVector{<:Point})
+Polygon(exterior::AbstractVector{<:Point}, interiors::Vector{<:AbstractVector{<:Point}})

Constructs a polygon from a set of exterior points. If interiors are given, each of them cuts away from the Polygon.

source
GeometryBasics.PolytopeType
Polytope{Dim, T} <: AbstractGeometry{Dim, T}

A Polytope is the generalization of a Polygon to higher dimensions, i.e. a geometric object consisting of flat faces.

A Polygon and Ngon are both 2D Polytopes. A Simplex is the simplest Polytope in arbitrary dimensions.

source
GeometryBasics.PolytopeMethod
Polytope(::Type{<: Point}, ::Type{<: AbstractNgonFace})

The Ngon Polytope element type when indexing an array of points with a SimplexFace

source
GeometryBasics.PolytopeMethod
Polytope(::Type{Point{Dim,T}}, ::Type{<:AbstractSimplexFace{N}})

The Simplex Polytope element type when indexing an array of points with a SimplexFace

source
GeometryBasics.PolytopeMethod
Polytope(::Type{<:NSimplex{N}}, P::Type{Point{NDim,T}})

The fully concrete Simplex type, when constructed from a point type!

source
GeometryBasics.PolytopeMethod
Polytope(::Type{<: Ngon}, P::Type{<: Point})

The fully concrete Ngon type, when constructed from a point type!

source
GeometryBasics.PyramidType
Pyramid(middle::Point3, length::Real, width::Real)

A Pyramid is an axis-aligned primitive where the tip of the Pyramid extends by length from middle in z direction and the square base extends by width in ±x and ±y direction from middle.

source
GeometryBasics.RectType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectMethod
Rect(vals::Number...)
Rect(vals::Number...)

Rect constructor for individually specified intervals. e.g. Rect(0,0,1,2) has origin == Vec(0,0) and width == Vec(1,2)

source
GeometryBasics.RectMethod
Rect(points::AbstractArray{<: Point})

Construct a bounding box countaining all the given points.

source
GeometryBasics.Rect2Type
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect2dType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect2fType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect2iType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3Type
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3dType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3fType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.Rect3iType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectdType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectfType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.RectiType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.SimplexType
Simplex{D, T<:Real, N}(points::NTuple{N, Point{D, T}})

A Simplex is a generalization of an N-dimensional tetrahedra and can be thought of as a minimal convex set containing the specified points.

  • A 0-simplex is a point.
  • A 1-simplex is a line segment.
  • A 2-simplex is a triangle.
  • A 3-simplex is a tetrahedron.

Note that this datatype is offset by one compared to the traditional mathematical terminology. So a one-simplex is represented as Simplex{2,T}. This is for a simpler implementation.

It applies to infinite dimensions. The structure of this type is designed to allow embedding in higher-order spaces by parameterizing on T.

source
GeometryBasics.TesselationType
Tesselation(primitive, nvertices)

When generating a mesh from an abstract geometry, we can typically generate it at different levels of detail, i.e. with different amounts of vertices. The Tesselation wrapper allows you to specify this level of detail. When generating a mesh from a tesselated geometry, the added information will be passed to coordinates, faces, etc.

sphere = Sphere(Point3f(0), 1)
 m1 = mesh(sphere) # uses a default value for tesselation
 m2 = mesh(Tesselation(sphere, 64)) # uses 64 for tesselation
 length(coordinates(m1)) != length(coordinates(m2))

For grid based tesselation, you can also use a tuple:

rect = Rect2(0, 0, 1, 1)
-Tesselation(rect, (5, 5))
source
GeometryBasics.TupleViewType
TupleView{T, N, Skip, A}

TupleView, groups elements of an array as tuples. N is the dimension of the tuple, M tells how many elements to skip to the next tuple. By default TupleView{N} defaults to skip N items.

a few examples:


+Tesselation(rect, (5, 5))
source
GeometryBasics.TupleViewType
TupleView{T, N, Skip, A}

TupleView, groups elements of an array as tuples. N is the dimension of the tuple, M tells how many elements to skip to the next tuple. By default TupleView{N} defaults to skip N items.

a few examples:


 x = [1, 2, 3, 4, 5, 6]
 TupleView{2, 1}(x):
 > [(1, 2), (2, 3), (3, 4), (4, 5), (5, 6)]
@@ -25,6 +25,6 @@
 TupleView{3, 1}(x):
 > [(1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 6)]

TupleView can be used together with reinterpret:

x = [1, 2, 3, 4]
 y = reinterpret(Point{2, Int}, TupleView{2, 1}(x))
-> [Point(1, 2), Point(2, 3), Point(3, 4)]
source
GeometryBasics.VecType
Vec{N, T}(args...)
-Vec{N, T}(args::Union{AbstractVector, Tuple, NTuple, StaticVector})

Constructs a Vec of length N from the given arguments.

Note that Point and Vec don't follow strict mathematical definitions. Instead we allow them to be used interchangeably.

Aliases

TFloat64Float32IntUInt
NVec{N,T}Vecd{N}Vecf{N}Veci{N}Vecui{N}
2Vec2{T}Vec2dVec2fVec2iVec2ui
3Vec3{T}Vec3dVec3fVec3iVec3ui
source
GeometryBasics.areaMethod
area(contour::AbstractVector{Point}})

Calculate the area of a polygon.

For 2D points, the oriented area is returned (negative when the points are oriented clockwise).

source
GeometryBasics.areaMethod
area(vertices::AbstractVector{Point{3}}, faces::AbstractVector{TriangleFace})

Calculate the area of all triangles.

source
GeometryBasics.areaMethod
area(vertices::AbstractVector{Point{3}}, face::TriangleFace)

Calculate the area of one triangle.

source
GeometryBasics.connectMethod
connect(points::AbstractVector{<: Point}, P::Type{<: Polytope{N}}, skip::Int = N)

Creates a view that connects a number of points to a Polytope P. Between each polytope, skip elements are skipped untill the next starts. Example: ```julia x = connect(Point[(1, 2), (3, 4), (5, 6), (7, 8)], Line, 2) x == [Line(Point(1, 2), Point(3, 4)), Line(Point(5, 6), Point(7, 8))]

source
GeometryBasics.coordinatesMethod
coordinates(geometry)

Returns the positions/coordinates of a geometry.

This is allowed to return lazy iterators. Use decompose(ConcretePointType, geometry) to get a Vector{ConcretePointType} with ConcretePointType being something like Point3f.

source
GeometryBasics.decomposeMethod
decompose(::Type{TargetType}, primitive)
-decompose(::Type{TargetType}, data::AbstractVector)

Dependent on the given type, extracts data from the primtive and converts its eltype to TargetType.

Possible TargetTypes:

  • <: Point extracts and converts positions (calling coordinates())
  • <: AbstractFace extracts and converts faces (calling faces())
  • <: Normal{<: Vec} extracts and converts normals, potentially generating them (calling normals())
  • <: UV{<: Vec} extracts and converts 2D texture coordinates, potentially generating them (calling texturecoordinates())
  • <: UVW{<: Vec} extracts and converts 3D texture coordinates, potentially generating them (calling texturecoordinates())
source
GeometryBasics.decomposeMethod
decompose(facetype, contour::AbstractArray{<:Point})

Triangulate a Polygon without hole.

Returns a Vector{facetype} defining indexes into contour.

source
GeometryBasics.face_normalsMethod
face_normals(positions::Vector{Point3{T}}, faces::Vector{<: NgonFace}[, target_type = Vec3{T}])

Compute face normals from the given positions and faces and returns an appropriate FaceView.

source
GeometryBasics.facesMethod
faces(geometry)

Returns the faces of a geometry.

This is allowed to return lazy iterators. Use decompose(ConcreteFaceType, geometry) to get a Vector{ConcreteFaceType} with ConcreteFaceType being something like GLTriangleFace.

source
GeometryBasics.normal_meshMethod
uv_normal_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, uvtype = Vec2f, normaltype = Vec3f])

Creates a triangle mesh with texture coordinates and normals from a given primitive. The pointtype, facetype and uvtype and normaltype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.normal_meshMethod
normal_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, normaltype = Vec3f])

Creates a triangle mesh with normals from a given primitive. The pointtype, facetype and uvtype and normaltype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.normalsFunction
normals(primitive)

Returns the normals of a geometry.

This is allowed to return lazy iterators. Use decompose_normals(ConcreteVecType, geometry) to get a Vector{ConcreteVecType} with ConcreteVecType being something like Vec3f.

source
GeometryBasics.normalsMethod
normals(positions::Vector{Point3{T}}, faces::Vector{<: NgonFace}[; normaltype = Vec3{T}])

Compute vertex normals from the given positions and faces.

This runs through all faces, computing a face normal each and adding it to every involved vertex. The direction of the face normal is based on winding direction and assumed counter-clockwise faces. At the end the summed face normals are normalized again to produce a vertex normal.

source
GeometryBasics.split_intersectionsMethod
split_intersections(points::AbstractVector{<: Point})

Splits polygon points into it's self intersecting parts. Only 1 intersection is handled right now.

source
GeometryBasics.texturecoordinatesFunction
texturecoordinates(primitive)

Returns the texturecoordinates of a geometry.

This is allowed to return lazy iterators. Use decompose_uv(ConcreteVecType, geometry) (or decompose_uvw) to get a Vector{ConcreteVecType} with ConcreteVecType being something like Vec2f.

source
GeometryBasics.uv_meshMethod
uv_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, uvtype = Vec2f])

Creates a triangle mesh with texture coordinates from a given primitive. The pointtype, facetype and uvtype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.uv_normal_meshMethod
uv_normal_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, uvtype = Vec2f, normaltype = Vec3f])

Creates a triangle mesh with texture coordinates and normals from a given primitive. The pointtype, facetype and uvtype and normaltype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.volumeMethod
volume(mesh)

Calculate the signed volume of all tetrahedra. Be sure the orientation of your surface is right.

source
GeometryBasics.volumeMethod
volume(triangle)

Calculate the signed volume of one tetrahedron. Be sure the orientation of your surface is right.

source

Private

GeometryBasics.NgonType
Ngon{D, T, N}(points::NTuple{N, Point{D, T}})

Defines a flat polygon (without holes) in D dimensional space using N points, e.g.:

  • N 1-2 : Illegal!
  • N = 3 : Triangle
  • N = 4 : Quadrilateral (or Quad, Or tetragon)
  • N = 5 : Pentagon
  • ...

For polygons with holes, see Polygon.

source
GeometryBasics.RectTType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.StaticVectorType
StaticVector{N, T} <: AbstractVector{T}

An abstract type for GeometryBasics statically sized Vectors. These are used for Point, Vec and Face types.

source
Base.:*Method
*(m::Mat, h::Rect)

Transform a Rect using a matrix. Maintains axis-align properties so a significantly larger Rect may be generated.

source
Base.inMethod
in(b1::Rect, b2::Rect)

Check if Rect b1 is contained in b2. This does not use strict inequality, so Rects may share faces and this will still return true.

source
Base.inMethod
in(pt::VecTypes, b1::Rect{N, T})

Check if a point is contained in a Rect. This will return true if the point is on a face of the Rect.

source
Base.inMethod
in(point, triangle)

Determine if a point is inside of a triangle.

source
Base.intersectMethod
intersect(h1::Rect, h2::Rect)

Perform a intersection between two Rects.

source
Base.isemptyMethod
isempty(h::Rect)

Return true if any of the widths of h are negative.

source
Base.mergeMethod
merge(meshes::AbstractVector{Mesh})

Generates a new mesh containing all the data of the individual meshes.

If all meshes are consistent in their use of FaceViews they will be preserved. Otherwise all of them will be converted with clear_faceviews(mesh).

source
Base.unionMethod
union(r1::Rect{N}, r2::Rect{N})

Returns a new Rect{N} which contains both r1 and r2.

source
GeometryBasics.clear_faceviewsMethod
clear_faceviews(mesh::Mesh)

Returns the given mesh if it contains no FaceViews. Otherwise, generates a new mesh that contains no FaceViews, reordering and duplicating vertex atttributes as necessary.

source
GeometryBasics.meshMethod
mesh(primitive::GeometryPrimitive[; pointtype = Point, facetype = GLTriangleFace, vertex_attributes...])

Creates a mesh from a given primitive with the given pointtype and facetype.

This method only generates positions and faces from the primitive. Additional vertex attributes like normals and texture coordinates can be given as extra keyword arguments.

Note that vertex attributes that are nothing get removed before creating a mesh.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.meshMethod
mesh(polygon::AbstractVector{P}; pointtype=P, facetype=GLTriangleFace)

Create a mesh from a polygon given as a vector of points, using triangulation.

source
GeometryBasics.meshMethod
mesh(positions, faces[, facetype = GLTriangleFace, vertex_attributes...])

Creates a mesh from the given positions and faces. Other vertex attributes like normals and texture coordinates can be added as keyword arguments.

Note that vertex attributes that are nothing get removed before creating a mesh.

See also:normal_mesh

source
GeometryBasics.meshMethod
mesh(mesh::Mesh[; pointtype = Point, facetype = GLTriangleFace, vertex_attributes...]

Recreates the given mesh with the given pointtype, facetype and vertex attributes. If the new mesh would match the old mesh, the old mesh is returned instead.

Note that vertex attributes that are nothing get removed before creating a mesh.

source
GeometryBasics.split_meshFunction
split_mesh(mesh::Mesh, views::Vector{UnitRange{Int}} = mesh.views)

Creates a new mesh containing faces(mesh)[range] for each range in views. This also removes unused vertices.

source
+> [Point(1, 2), Point(2, 3), Point(3, 4)]
source
GeometryBasics.VecType
Vec{N, T}(args...)
+Vec{N, T}(args::Union{AbstractVector, Tuple, NTuple, StaticVector})

Constructs a Vec of length N from the given arguments.

Note that Point and Vec don't follow strict mathematical definitions. Instead we allow them to be used interchangeably.

Aliases

TFloat64Float32IntUInt
NVec{N,T}Vecd{N}Vecf{N}Veci{N}Vecui{N}
2Vec2{T}Vec2dVec2fVec2iVec2ui
3Vec3{T}Vec3dVec3fVec3iVec3ui
source
GeometryBasics.areaMethod
area(contour::AbstractVector{Point}})

Calculate the area of a polygon.

For 2D points, the oriented area is returned (negative when the points are oriented clockwise).

source
GeometryBasics.areaMethod
area(vertices::AbstractVector{Point{3}}, faces::AbstractVector{TriangleFace})

Calculate the area of all triangles.

source
GeometryBasics.areaMethod
area(vertices::AbstractVector{Point{3}}, face::TriangleFace)

Calculate the area of one triangle.

source
GeometryBasics.connectMethod
connect(points::AbstractVector{<: Point}, P::Type{<: Polytope{N}}, skip::Int = N)

Creates a view that connects a number of points to a Polytope P. Between each polytope, skip elements are skipped untill the next starts. Example: ```julia x = connect(Point[(1, 2), (3, 4), (5, 6), (7, 8)], Line, 2) x == [Line(Point(1, 2), Point(3, 4)), Line(Point(5, 6), Point(7, 8))]

source
GeometryBasics.coordinatesMethod
coordinates(geometry)

Returns the positions/coordinates of a geometry.

This is allowed to return lazy iterators. Use decompose(ConcretePointType, geometry) to get a Vector{ConcretePointType} with ConcretePointType being something like Point3f.

source
GeometryBasics.decomposeMethod
decompose(::Type{TargetType}, primitive)
+decompose(::Type{TargetType}, data::AbstractVector)

Dependent on the given type, extracts data from the primtive and converts its eltype to TargetType.

Possible TargetTypes:

  • <: Point extracts and converts positions (calling coordinates())
  • <: AbstractFace extracts and converts faces (calling faces())
  • <: Normal{<: Vec} extracts and converts normals, potentially generating them (calling normals())
  • <: UV{<: Vec} extracts and converts 2D texture coordinates, potentially generating them (calling texturecoordinates())
  • <: UVW{<: Vec} extracts and converts 3D texture coordinates, potentially generating them (calling texturecoordinates())
source
GeometryBasics.decomposeMethod
decompose(facetype, contour::AbstractArray{<:Point})

Triangulate a Polygon without hole.

Returns a Vector{facetype} defining indexes into contour.

source
GeometryBasics.face_normalsMethod
face_normals(positions::Vector{Point3{T}}, faces::Vector{<: NgonFace}[, target_type = Vec3{T}])

Compute face normals from the given positions and faces and returns an appropriate FaceView.

source
GeometryBasics.facesMethod
faces(geometry)

Returns the faces of a geometry.

This is allowed to return lazy iterators. Use decompose(ConcreteFaceType, geometry) to get a Vector{ConcreteFaceType} with ConcreteFaceType being something like GLTriangleFace.

source
GeometryBasics.normal_meshMethod
uv_normal_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, uvtype = Vec2f, normaltype = Vec3f])

Creates a triangle mesh with texture coordinates and normals from a given primitive. The pointtype, facetype and uvtype and normaltype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.normal_meshMethod
normal_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, normaltype = Vec3f])

Creates a triangle mesh with normals from a given primitive. The pointtype, facetype and uvtype and normaltype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.normalsFunction
normals(primitive)

Returns the normals of a geometry.

This is allowed to return lazy iterators. Use decompose_normals(ConcreteVecType, geometry) to get a Vector{ConcreteVecType} with ConcreteVecType being something like Vec3f.

source
GeometryBasics.normalsMethod
normals(positions::Vector{Point3{T}}, faces::Vector{<: NgonFace}[; normaltype = Vec3{T}])

Compute vertex normals from the given positions and faces.

This runs through all faces, computing a face normal each and adding it to every involved vertex. The direction of the face normal is based on winding direction and assumed counter-clockwise faces. At the end the summed face normals are normalized again to produce a vertex normal.

source
GeometryBasics.split_intersectionsMethod
split_intersections(points::AbstractVector{<: Point})

Splits polygon points into it's self intersecting parts. Only 1 intersection is handled right now.

source
GeometryBasics.texturecoordinatesFunction
texturecoordinates(primitive)

Returns the texturecoordinates of a geometry.

This is allowed to return lazy iterators. Use decompose_uv(ConcreteVecType, geometry) (or decompose_uvw) to get a Vector{ConcreteVecType} with ConcreteVecType being something like Vec2f.

source
GeometryBasics.uv_meshMethod
uv_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, uvtype = Vec2f])

Creates a triangle mesh with texture coordinates from a given primitive. The pointtype, facetype and uvtype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.uv_normal_meshMethod
uv_normal_mesh(primitive::GeometryPrimitive{N}[; pointtype = Point{N, Float32}, facetype = GLTriangleFace, uvtype = Vec2f, normaltype = Vec3f])

Creates a triangle mesh with texture coordinates and normals from a given primitive. The pointtype, facetype and uvtype and normaltype are set by the correspondering keyword arguments.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.volumeMethod
volume(mesh)

Calculate the signed volume of all tetrahedra. Be sure the orientation of your surface is right.

source
GeometryBasics.volumeMethod
volume(triangle)

Calculate the signed volume of one tetrahedron. Be sure the orientation of your surface is right.

source

Private

GeometryBasics.NgonType
Ngon{D, T, N}(points::NTuple{N, Point{D, T}})

Defines a flat polygon (without holes) in D dimensional space using N points, e.g.:

  • N 1-2 : Illegal!
  • N = 3 : Triangle
  • N = 4 : Quadrilateral (or Quad, Or tetragon)
  • N = 5 : Pentagon
  • ...

For polygons with holes, see Polygon.

source
GeometryBasics.RectTType
const Rect{N,T} = HyperRectangle{N,T}

A rectangle in N dimensions, formally the cartesian product of intervals. See also HyperRectangle. Its aliases are

T(eltype)Float64Float32Int
N(dim)Rect{N,T}Rectd{N}Rectf{N}Recti{N}
2Rect2{T}Rect2dRect2fRect2i
3Rect3{T}Rect3dRect3fRect3i

There is an additional unexported alias RectT that simply reverses the order of type parameters: RectT{T,N} == Rect{N,T}.

source
GeometryBasics.StaticVectorType
StaticVector{N, T} <: AbstractVector{T}

An abstract type for GeometryBasics statically sized Vectors. These are used for Point, Vec and Face types.

source
Base.:*Method
*(m::Mat, h::Rect)

Transform a Rect using a matrix. Maintains axis-align properties so a significantly larger Rect may be generated.

source
Base.inMethod
in(b1::Rect, b2::Rect)

Check if Rect b1 is contained in b2. This does not use strict inequality, so Rects may share faces and this will still return true.

source
Base.inMethod
in(pt::VecTypes, b1::Rect{N, T})

Check if a point is contained in a Rect. This will return true if the point is on a face of the Rect.

source
Base.inMethod
in(point, triangle)

Determine if a point is inside of a triangle.

source
Base.intersectMethod
intersect(h1::Rect, h2::Rect)

Perform a intersection between two Rects.

source
Base.isemptyMethod
isempty(h::Rect)

Return true if any of the widths of h are negative.

source
Base.mergeMethod
merge(meshes::AbstractVector{Mesh})

Generates a new mesh containing all the data of the individual meshes.

If all meshes are consistent in their use of FaceViews they will be preserved. Otherwise all of them will be converted with clear_faceviews(mesh).

source
Base.unionMethod
union(r1::Rect{N}, r2::Rect{N})

Returns a new Rect{N} which contains both r1 and r2.

source
GeometryBasics.clear_faceviewsMethod
clear_faceviews(mesh::Mesh)

Returns the given mesh if it contains no FaceViews. Otherwise, generates a new mesh that contains no FaceViews, reordering and duplicating vertex atttributes as necessary.

source
GeometryBasics.meshMethod
mesh(primitive::GeometryPrimitive[; pointtype = Point, facetype = GLTriangleFace, vertex_attributes...])

Creates a mesh from a given primitive with the given pointtype and facetype.

This method only generates positions and faces from the primitive. Additional vertex attributes like normals and texture coordinates can be given as extra keyword arguments.

Note that vertex attributes that are nothing get removed before creating a mesh.

See also: triangle_mesh, normal_mesh, uv_mesh, uv_normal_mesh

source
GeometryBasics.meshMethod
mesh(polygon::AbstractVector{P}; pointtype=P, facetype=GLTriangleFace)

Create a mesh from a polygon given as a vector of points, using triangulation.

source
GeometryBasics.meshMethod
mesh(positions, faces[, facetype = GLTriangleFace, vertex_attributes...])

Creates a mesh from the given positions and faces. Other vertex attributes like normals and texture coordinates can be added as keyword arguments.

Note that vertex attributes that are nothing get removed before creating a mesh.

See also:normal_mesh

source
GeometryBasics.meshMethod
mesh(mesh::Mesh[; pointtype = Point, facetype = GLTriangleFace, vertex_attributes...]

Recreates the given mesh with the given pointtype, facetype and vertex attributes. If the new mesh would match the old mesh, the old mesh is returned instead.

Note that vertex attributes that are nothing get removed before creating a mesh.

source
GeometryBasics.split_meshFunction
split_mesh(mesh::Mesh, views::Vector{UnitRange{Int}} = mesh.views)

Creates a new mesh containing faces(mesh)[range] for each range in views. This also removes unused vertices.

source
diff --git a/previews/PR219/decomposition/index.html b/previews/PR219/decomposition/index.html index e2824dc0..dd64a04d 100644 --- a/previews/PR219/decomposition/index.html +++ b/previews/PR219/decomposition/index.html @@ -1,2 +1,2 @@ -Decomposition · GeometryBasics.jl

Decomposition

decompose functions

The decompose functions allow you to grab certain data from an AbstractGeometry like a mesh or primitive and convert it to a requested type, if possible. They can also be used to convert an array of e.g. faces into a different face type directly. The default decomposition implemented by GeoemtryBasics are:

  • decompose(::Type{<: Point}, source) which collects data from source using coordinates(source) and converts it to the given point type.
  • decompose_normals([::Type{<: Vec},] source) = decompose([::Type{Normals{<: Vec}}},] source) which collects data with normals(source) and converts it to the given Vec type.
  • decompose_uv([::Type{<: Vec},] source) = decompose([::Type{UV{<: Vec}}},] source) which collects data with texturecoordinates(source) and converts it to the given Vec type. This function also exists with UVW texture coordinates.
  • decompose(::Type{<: AbstractFace}, source) which collects data with faces(source) and converts it to the given face type.

Primitive decomposition

GeometryBasics defines an interface to decompose geometry primitives into vertex attributes and faces. The interface includes four functions:

  • coordinates(primitive[, nvertices]) which produces the positions associated with the primitive
  • faces(primitive[, nvertices]) which produces the faces which connect the vertex positions to a mesh
  • normals(primitive[, nvertices]) which optionally provide normal vectors of the primitive
  • texturecoordinates(primitive[, nvertices]) which optional provide texture coordinates (uv/uvw) of the primitive
+Decomposition · GeometryBasics.jl

Decomposition

decompose functions

The decompose functions allow you to grab certain data from an AbstractGeometry like a mesh or primitive and convert it to a requested type, if possible. They can also be used to convert an array of e.g. faces into a different face type directly. The default decomposition implemented by GeoemtryBasics are:

  • decompose(::Type{<: Point}, source) which collects data from source using coordinates(source) and converts it to the given point type.
  • decompose_normals([::Type{<: Vec},] source) = decompose([::Type{Normals{<: Vec}}},] source) which collects data with normals(source) and converts it to the given Vec type.
  • decompose_uv([::Type{<: Vec},] source) = decompose([::Type{UV{<: Vec}}},] source) which collects data with texturecoordinates(source) and converts it to the given Vec type. This function also exists with UVW texture coordinates.
  • decompose(::Type{<: AbstractFace}, source) which collects data with faces(source) and converts it to the given face type.

Primitive decomposition

GeometryBasics defines an interface to decompose geometry primitives into vertex attributes and faces. The interface includes four functions:

  • coordinates(primitive[, nvertices]) which produces the positions associated with the primitive
  • faces(primitive[, nvertices]) which produces the faces which connect the vertex positions to a mesh
  • normals(primitive[, nvertices]) which optionally provide normal vectors of the primitive
  • texturecoordinates(primitive[, nvertices]) which optional provide texture coordinates (uv/uvw) of the primitive
diff --git a/previews/PR219/index.html b/previews/PR219/index.html index 173cb2ab..7b595a13 100644 --- a/previews/PR219/index.html +++ b/previews/PR219/index.html @@ -11,4 +11,4 @@ faces: 2 vertex position: 4

Use GeometryBasics.mesh to get a mesh directly from a geometry:

julia> mesh = GeometryBasics.mesh(rect)Mesh{2, Float64, NgonFace{3, OffsetInteger{-1, UInt32}}}
     faces: 2
-    vertex position: 4
+ vertex position: 4 diff --git a/previews/PR219/meshes/index.html b/previews/PR219/meshes/index.html index d7fb6f75..45f8be9c 100644 --- a/previews/PR219/meshes/index.html +++ b/previews/PR219/meshes/index.html @@ -14,4 +14,4 @@ end

Its purpose is to allow you to add data that needs to be defined per vertex but does not match the vertex structure used by mesh.faces.

As a minimal example consider a mesh that is just one triangle, i.e. 3 position and one triangle face TriangleFace(1,2,3). Let's say we want to add a flat color to the triangle. In this case we only have one color, but our face refers to 3 different vertices (3 different positions). To avoid duplicating the color data, we can instead define a new triangle face TriangleFace(1) and add the color attribute as a FaceView([color], [TriangleFace(1)]). If we ever need the mesh to be defined with just one common set of faces, i.e. no FaceView and appropriately duplicated vertex data, we can use GeometryBasics.clear_faceviews(mesh) to generate it.

On a larger scale this can be useful for memory and performance reason, e.g. when you do calculations with vertex attributes. It can also simplify some definitions, like for example Rect3. In that case we have 8 positions and 6 normals with FaceViews, or 24 without (assuming per-face normals).

MetaMesh

A MetaMesh is given by

struct MetaMesh{Dim, T, M <: AbstractMesh{Dim, T}} <: AbstractMesh{Dim, T}
     mesh::M
     meta::Dict{Symbol, Any}
-end

where meta may contain any data you want to include with a mesh. For example, you could include group names or material data corresponding to mesh.views.

How to create a mesh

GeometryBasics

In GeometryBasics you mainly create meshes from primitives using a few constructors:

Each of these constructors also includes keyword arguments for setting types, i.e. pointtype, facetype, normaltype and uvtype as appropriate. Of course you can also construct a mesh directly from data, either with there various Mesh() or GeometryBasics.mesh() constructors. The latter also include a pointtype and facetype conversion.

Finally there is also a merge(::Vector{Mesh}) function which combines multiple meshes into a single one. Note that this doesn't remove any data (e.g. hidden or duplicate vertices), and may remove FaceViews if they are incompatible between meshes.

Meshing.jl

MeshIO.jl

The MeshIO.jl package provides load/save support for several file formats which store meshes.

+end

where meta may contain any data you want to include with a mesh. For example, you could include group names or material data corresponding to mesh.views.

How to create a mesh

GeometryBasics

In GeometryBasics you mainly create meshes from primitives using a few constructors:

Each of these constructors also includes keyword arguments for setting types, i.e. pointtype, facetype, normaltype and uvtype as appropriate. Of course you can also construct a mesh directly from data, either with there various Mesh() or GeometryBasics.mesh() constructors. The latter also include a pointtype and facetype conversion.

Finally there is also a merge(::Vector{Mesh}) function which combines multiple meshes into a single one. Note that this doesn't remove any data (e.g. hidden or duplicate vertices), and may remove FaceViews if they are incompatible between meshes.

Meshing.jl

MeshIO.jl

The MeshIO.jl package provides load/save support for several file formats which store meshes.

diff --git a/previews/PR219/polygons/index.html b/previews/PR219/polygons/index.html index 79cadf5a..c9547678 100644 --- a/previews/PR219/polygons/index.html +++ b/previews/PR219/polygons/index.html @@ -1,2 +1,2 @@ -Polygons · GeometryBasics.jl
+Polygons · GeometryBasics.jl
diff --git a/previews/PR219/primitives/index.html b/previews/PR219/primitives/index.html index 0f9dd9e1..55ee28d7 100644 --- a/previews/PR219/primitives/index.html +++ b/previews/PR219/primitives/index.html @@ -30,4 +30,4 @@ (7, 8, 11, 10), (8, 9, 12, 11) ] return FaceView(uvs, fs) -end +end diff --git a/previews/PR219/static_array_types/index.html b/previews/PR219/static_array_types/index.html index 6fbc4ca3..42f16680 100644 --- a/previews/PR219/static_array_types/index.html +++ b/previews/PR219/static_array_types/index.html @@ -1,4 +1,4 @@ Point, Vec and Mat · GeometryBasics.jl

Point, Vec and Mat

GeometryBasics defines its own set of (small) Static Vectors and Matrices:

Point{N,T} <: StaticVector{N,T} <: AbstractVector{T}
 Vec{N,T} <: StaticVector{N,T} <: AbstractVector{T}
-Mat{Row, Column, T, L} <: AbstractMatrix{T}

These types are used throughout GeometryBasics to speed up calculations similar to how StaticArrays.jl does.

Aliases

GeometryBasics exports common aliases for Point, Vec, Mat and Rect:

Vec

T(eltype)Float64Float32IntUInt
N(dim)Vec{N,T}Vecd{N}Vecf{N}Veci{N}Vecui{N}
2Vec2{T}Vec2dVec2fVec2iVec2ui
3Vec3{T}Vec3dVec3fVec3iVec3ui

Point

T(eltype)Float64Float32IntUInt
N(dim)Point{N,T}Pointd{N}Pointf{N}Pointi{N}Pointui{N}
2Point2{T}Point2dPoint2fPoint2iPoint2ui
3Point3{T}Point3dPoint3fPoint3iPoint3ui

Mat

T(eltype)Float64Float32IntUInt
N(dim)Mat{N,T}Matd{N}Matf{N}Mati{N}Matui{N}
2Mat2{T}Mat2dMat2fMat2iMat2ui
3Mat3{T}Mat3dMat3fMat3iMat3ui
+Mat{Row, Column, T, L} <: AbstractMatrix{T}

These types are used throughout GeometryBasics to speed up calculations similar to how StaticArrays.jl does.

Aliases

GeometryBasics exports common aliases for Point, Vec, Mat and Rect:

Vec

T(eltype)Float64Float32IntUInt
N(dim)Vec{N,T}Vecd{N}Vecf{N}Veci{N}Vecui{N}
2Vec2{T}Vec2dVec2fVec2iVec2ui
3Vec3{T}Vec3dVec3fVec3iVec3ui

Point

T(eltype)Float64Float32IntUInt
N(dim)Point{N,T}Pointd{N}Pointf{N}Pointi{N}Pointui{N}
2Point2{T}Point2dPoint2fPoint2iPoint2ui
3Point3{T}Point3dPoint3fPoint3iPoint3ui

Mat

T(eltype)Float64Float32IntUInt
N(dim)Mat{N,T}Matd{N}Matf{N}Mati{N}Matui{N}
2Mat2{T}Mat2dMat2fMat2iMat2ui
3Mat3{T}Mat3dMat3fMat3iMat3ui