Skip to content

Get rid of StaticArrays #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.4.2"
EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"

StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Expand Down
18 changes: 6 additions & 12 deletions src/GeometryBasics.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module GeometryBasics

using StaticArrays, Tables, StructArrays, IterTools, LinearAlgebra
using Tables, StructArrays, IterTools, LinearAlgebra
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using Tables, StructArrays, IterTools, LinearAlgebra
using StaticArraysCore, Tables, StructArrays, IterTools, LinearAlgebra

using EarCut_jll
import Base: *

using Base: @propagate_inbounds

include("mat.jl")
include("fixed_arrays.jl")
include("offsetintegers.jl")
include("basic_types.jl")
Expand All @@ -24,8 +26,6 @@ include("triangulation.jl")
include("lines.jl")
include("boundingboxes.jl")

include("deprecated.jl")

export AbstractGeometry, GeometryPrimitive
export Mat, Point, Vec
export LineFace, Polytope, Line, NgonFace, convert_simplex
Expand All @@ -43,18 +43,12 @@ export PolygonMeta, MultiPointMeta, MultiLineStringMeta, MeshMeta, LineStringMet
export decompose, coordinates, faces, normals, decompose_uv, decompose_normals,
texturecoordinates
export Tesselation, pointmeta, Normal, UV, UVW
export GLTriangleFace, GLNormalMesh3D, GLPlainTriangleMesh, GLUVMesh3D, GLUVNormalMesh3D
export AbstractMesh, Mesh, TriangleMesh
export GLNormalMesh2D, PlainTriangleMesh
export AbstractMesh, Mesh
export MetaT, meta_table

# all the different predefined mesh types
# Note: meshes can contain arbitrary meta information,
export AbstractMesh, TriangleMesh, PlainMesh, GLPlainMesh, GLPlainMesh2D, GLPlainMesh3D
export UVMesh, GLUVMesh, GLUVMesh2D, GLUVMesh3D
export NormalMesh, GLNormalMesh, GLNormalMesh2D, GLNormalMesh3D
export NormalUVMesh, GLNormalUVMesh, GLNormalUVMesh2D, GLNormalUVMesh3D
export NormalUVWMesh, GLNormalUVWMesh, GLNormalUVWMesh2D, GLNormalUVWMesh3D
export AbstractMesh, TriangleMesh, PlainMesh

# mesh creation functions
export triangle_mesh, triangle_mesh, uv_mesh
Expand All @@ -71,7 +65,7 @@ export min_euclideansq, minmax_dist_dim, minmax_euclidean, minmax_euclideansq
export self_intersections, split_intersections

if Base.VERSION >= v"1.4.2"
include("precompile.jl")
include("precompiles.jl")
_precompile_()
end

Expand Down
19 changes: 6 additions & 13 deletions src/basic_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,19 @@ Note That `Polytope{N} where N == 3` denotes a Triangle both as a Simplex or Ngo
abstract type Polytope{Dim,T} <: AbstractGeometry{Dim,T} end
abstract type AbstractPolygon{Dim,T} <: Polytope{Dim,T} end

abstract type AbstractPoint{Dim,T} <: StaticVector{Dim,T} end
abstract type AbstractFace{N,T} <: StaticVector{N,T} end
abstract type AbstractSimplexFace{N,T} <: AbstractFace{N,T} end
abstract type AbstractNgonFace{N,T} <: AbstractFace{N,T} end

abstract type AbstractSimplex{Dim,N,T} <: StaticVector{Dim,T} end

"""
Face index, connecting points to form a simplex
"""

@fixed_vector SimplexFace AbstractSimplexFace

const TetrahedronFace{T} = SimplexFace{4,T}
Face(::Type{<:SimplexFace{N}}, ::Type{T}) where {N,T} = SimplexFace{N,T}

"""
Face index, connecting points to form an Ngon
"""

@fixed_vector NgonFace AbstractNgonFace

const LineFace{T} = NgonFace{2,T}
const TriangleFace{T} = NgonFace{3,T}
const QuadFace{T} = NgonFace{4,T}
Expand All @@ -58,14 +51,14 @@ Fixed Size Polygon, e.g.
"""
struct Ngon{Dim,T<:Real,N,Point<:AbstractPoint{Dim,T}} <: AbstractPolygon{Dim,T}

points::SVector{N,Point}
points::Vec{N,Point}
end

const NNgon{N} = Ngon{Dim,T,N,P} where {Dim,T,P}

function (::Type{<:NNgon{N}})(points::Vararg{P,N}) where {P<:AbstractPoint{Dim,T},
N} where {Dim,T}
return Ngon{Dim,T,N,P}(SVector(points))
return Ngon{Dim,T,N,P}(Vec(points))
end
Base.show(io::IO, x::NNgon{N}) where {N} = print(io, "Ngon{$N}(", join(x, ", "), ")")

Expand Down Expand Up @@ -138,7 +131,7 @@ to allow embedding in higher-order spaces by parameterizing on `T`.
"""
struct Simplex{Dim,T<:Real,N,Point<:AbstractPoint{Dim,T}} <: Polytope{Dim,T}

points::SVector{N,Point}
points::Vec{N,Point}
end

const NSimplex{N} = Simplex{Dim,T,N,P} where {Dim,T,P}
Expand All @@ -151,7 +144,7 @@ coordinates(x::Simplex) = x.points

function (::Type{<:NSimplex{N}})(points::Vararg{P,N}) where {P<:AbstractPoint{Dim,T},
N} where {Dim,T}
return Simplex{Dim,T,N,P}(SVector(points))
return Simplex{Dim,T,N,P}(Vec(points))
end

# Base Array interface
Expand Down
30 changes: 0 additions & 30 deletions src/deprecated.jl

This file was deleted.

Loading