Skip to content

Commit 7c45344

Browse files
committed
Replace f0 suffix with f
1 parent 8747437 commit 7c45344

File tree

11 files changed

+91
-90
lines changed

11 files changed

+91
-90
lines changed

docs/src/decomposition.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ But will actually not be an iterator anymore. Instead, the mesh constructor uses
4848
the `decompose` function, that will collect the result of coordinates and will
4949
convert it to a concrete element type:
5050
```julia
51-
decompose(Point2f0, rect) == convert(Vector{Point2f0}, collect(coordinates(rect)))
51+
decompose(Point2f, rect) == convert(Vector{Point2f}, collect(coordinates(rect)))
5252
```
5353
The element conversion is handled by `simplex_convert`, which also handles convert
5454
between different face types:
@@ -65,12 +65,12 @@ decompose(Point, rect) isa Vector{Point{2, Float64}}
6565
```
6666
You can also pass the element type to `mesh`:
6767
```julia
68-
m = GeometryBasics.mesh(rect, pointtype=Point2f0, facetype=QuadFace{Int})
68+
m = GeometryBasics.mesh(rect, pointtype=Point2f, facetype=QuadFace{Int})
6969
```
7070
You can also set the uv and normal type for the mesh constructor, which will then
7171
calculate them for you, with the requested element type:
7272
```julia
73-
m = GeometryBasics.mesh(rect, uv=Vec2f0, normaltype=Vec3f0)
73+
m = GeometryBasics.mesh(rect, uv=Vec2f, normaltype=Vec3f)
7474
```
7575

7676
As you can see, the normals are automatically calculated,
@@ -79,11 +79,11 @@ the same is true for texture coordinates. You can overload this behavior by over
7979
`decompose` works a bit different for normals/texturecoordinates, since they dont have their own element type.
8080
Instead, you can use `decompose` like this:
8181
```julia
82-
decompose(UV(Vec2f0), rect)
83-
decompose(Normal(Vec3f0), rect)
82+
decompose(UV(Vec2f), rect)
83+
decompose(Normal(Vec3f), rect)
8484
# the short form for the above:
8585
decompose_uv(rect)
8686
decompose_normals(rect)
8787
```
8888
You can also use `triangle_mesh`, `normal_mesh` and `uv_normal_mesh` to call the
89-
`mesh` constructor with predefined element types (Point2/3f0, Vec2/3f0), and the requested attributes.
89+
`mesh` constructor with predefined element types (Point2/3f, Vec2/3f), and the requested attributes.

src/GeometryBasics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ include("triangulation.jl")
2424
include("lines.jl")
2525
include("boundingboxes.jl")
2626

27+
include("deprecated.jl")
28+
2729
export AbstractGeometry, GeometryPrimitive
2830
export Mat, Point, Vec
2931
export LineFace, Polytope, Line, NgonFace, convert_simplex

src/fixed_arrays.jl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,31 +121,30 @@ abstract type AbstractPoint{Dim,T} <: StaticVector{Dim,T} end
121121

122122
const Mat = SMatrix
123123
const VecTypes{N,T} = Union{StaticVector{N,T},NTuple{N,T}}
124-
const Vecf0{N} = Vec{N,Float32}
125-
const Pointf0{N} = Point{N,Float32}
124+
const Vecf{N} = Vec{N,Float32}
125+
const Pointf{N} = Point{N,Float32}
126126
Base.isnan(p::Union{AbstractPoint,Vec}) = any(x -> isnan(x), p)
127127

128-
# Create constes like Mat4f0, Point2, Point2f0
129128
for i in 1:4
130129
for T in [:Point, :Vec]
131130
name = Symbol("$T$i")
132-
namef0 = Symbol("$T$(i)f0")
131+
namef = Symbol("$T$(i)f")
133132
@eval begin
134133
const $name = $T{$i}
135-
const $namef0 = $T{$i,Float32}
134+
const $namef = $T{$i,Float32}
136135
export $name
137-
export $namef0
136+
export $namef
138137
end
139138
end
140139
name = Symbol("Mat$i")
141-
namef0 = Symbol("Mat$(i)f0")
140+
namef = Symbol("Mat$(i)f")
142141
@eval begin
143142
const $name{T} = $Mat{$i,$i,T,$(i * i)}
144-
const $namef0 = $name{Float32}
143+
const $namef = $name{Float32}
145144
export $name
146-
export $namef0
145+
export $namef
147146
end
148147
end
149148

150149
export Mat, Vec, Point, unit
151-
export Vecf0, Pointf0
150+
export Vecf, Pointf

src/interfaces.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ To transport this information to the various decompose methods, you can wrap it
4343
in the Tesselation object e.g. like this:
4444
4545
```julia
46-
sphere = Sphere(Point3f0(0), 1)
46+
sphere = Sphere(Point3f(0), 1)
4747
m1 = mesh(sphere) # uses a default value for tesselation
4848
m2 = mesh(Tesselation(sphere, 64)) # uses 64 for tesselation
4949
length(coordinates(m1)) != length(coordinates(m2))
@@ -81,7 +81,7 @@ function texturecoordinates(tesselation::Tesselation)
8181
end
8282

8383
## Decompose methods
84-
# Dispatch type to make `decompose(UV{Vec2f0}, primitive)` work
84+
# Dispatch type to make `decompose(UV{Vec2f}, primitive)` work
8585
# and to pass through tesselation information
8686

8787
# Types that can be converted to a mesh via the functions below
@@ -91,13 +91,13 @@ const Meshable{Dim,T} = Union{Tesselation{Dim,T},Mesh{Dim,T},AbstractPolygon{Dim
9191

9292
struct UV{T} end
9393
UV(::Type{T}) where {T} = UV{T}()
94-
UV() = UV(Vec2f0)
94+
UV() = UV(Vec2f)
9595
struct UVW{T} end
9696
UVW(::Type{T}) where {T} = UVW{T}()
97-
UVW() = UVW(Vec3f0)
97+
UVW() = UVW(Vec3f)
9898
struct Normal{T} end
9999
Normal(::Type{T}) where {T} = Normal{T}()
100-
Normal() = Normal(Vec3f0)
100+
Normal() = Normal(Vec3f)
101101

102102
function decompose(::Type{F}, primitive) where {F<:AbstractFace}
103103
f = faces(primitive)

src/meshes.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const GLPlainMesh3D = GLPlainMesh{3}
4444
UVMesh{Dim, T}
4545
4646
PlainMesh with texture coordinates meta at each point.
47-
`uvmesh.uv isa AbstractVector{Vec2f0}`
47+
`uvmesh.uv isa AbstractVector{Vec2f}`
4848
"""
4949
const UVMesh{Dim,T} = TriangleMesh{Dim,T,PointWithUV{Dim,T}}
5050
const GLUVMesh{Dim} = UVMesh{Dim,Float32}
@@ -55,7 +55,7 @@ const GLUVMesh3D = UVMesh{3}
5555
NormalMesh{Dim, T}
5656
5757
PlainMesh with normals meta at each point.
58-
`normalmesh.normals isa AbstractVector{Vec3f0}`
58+
`normalmesh.normals isa AbstractVector{Vec3f}`
5959
"""
6060
const NormalMesh{Dim,T} = TriangleMesh{Dim,T,PointWithNormal{Dim,T}}
6161
const GLNormalMesh{Dim} = NormalMesh{Dim,Float32}
@@ -66,8 +66,8 @@ const GLNormalMesh3D = GLNormalMesh{3}
6666
NormalUVMesh{Dim, T}
6767
6868
PlainMesh with normals and uv meta at each point.
69-
`normalmesh.normals isa AbstractVector{Vec3f0}`
70-
`normalmesh.uv isa AbstractVector{Vec2f0}`
69+
`normalmesh.normals isa AbstractVector{Vec3f}`
70+
`normalmesh.uv isa AbstractVector{Vec2f}`
7171
"""
7272
const NormalUVMesh{Dim,T} = TriangleMesh{Dim,T,PointWithUVNormal{Dim,T}}
7373
const GLNormalUVMesh{Dim} = NormalUVMesh{Dim,Float32}
@@ -78,8 +78,8 @@ const GLNormalUVMesh3D = GLNormalUVMesh{3}
7878
NormalUVWMesh{Dim, T}
7979
8080
PlainMesh with normals and uvw (texture coordinates in 3D) meta at each point.
81-
`normalmesh.normals isa AbstractVector{Vec3f0}`
82-
`normalmesh.uvw isa AbstractVector{Vec3f0}`
81+
`normalmesh.normals isa AbstractVector{Vec3f}`
82+
`normalmesh.uvw isa AbstractVector{Vec3f}`
8383
"""
8484
const NormalUVWMesh{Dim,T} = TriangleMesh{Dim,T,PointWithUVWNormal{Dim,T}}
8585
const GLNormalUVWMesh{Dim} = NormalUVWMesh{Dim,Float32}
@@ -176,17 +176,17 @@ function triangle_mesh(primitive::Meshable{N}; nvertices=nothing) where {N}
176176
end
177177

178178
function uv_mesh(primitive::Meshable{N,T}) where {N,T}
179-
return mesh(primitive; pointtype=Point{N,Float32}, uv=Vec2f0, facetype=GLTriangleFace)
179+
return mesh(primitive; pointtype=Point{N,Float32}, uv=Vec2f, facetype=GLTriangleFace)
180180
end
181181

182182
function uv_normal_mesh(primitive::Meshable{N}) where {N}
183-
return mesh(primitive; pointtype=Point{N,Float32}, uv=Vec2f0, normaltype=Vec3f0,
183+
return mesh(primitive; pointtype=Point{N,Float32}, uv=Vec2f, normaltype=Vec3f,
184184
facetype=GLTriangleFace)
185185
end
186186

187187
function normal_mesh(points::AbstractVector{<:AbstractPoint},
188188
faces::AbstractVector{<:AbstractFace})
189-
_points = decompose(Point3f0, points)
189+
_points = decompose(Point3f, points)
190190
_faces = decompose(GLTriangleFace, faces)
191191
return Mesh(meta(_points; normals=normals(_points, _faces)), _faces)
192192
end
@@ -196,7 +196,7 @@ function normal_mesh(primitive::Meshable{N}; nvertices=nothing) where {N}
196196
@warn("nvertices argument deprecated. Wrap primitive in `Tesselation(primitive, nvertices)`")
197197
primitive = Tesselation(primitive, nvertices)
198198
end
199-
return mesh(primitive; pointtype=Point{N,Float32}, normaltype=Vec3f0,
199+
return mesh(primitive; pointtype=Point{N,Float32}, normaltype=Vec3f,
200200
facetype=GLTriangleFace)
201201
end
202202

src/precompile.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ function _precompile_()
2626
@warnpcfail precompile(Tuple{typeof(*),HyperRectangle{2, Float32},Float32}) # time: 0.001057589
2727

2828
if Base.VERSION >= v"1.6.0-DEV.1083"
29-
@warnpcfail precompile(triangle_mesh, (Polygon{2, Float32, Point2f0, LineString{2, Float32, Point2f0,
30-
Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}, false}},
31-
Vector{LineString{2, Float32, Point2f0, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}, false}}}},))
29+
@warnpcfail precompile(triangle_mesh, (Polygon{2, Float32, Point2f, LineString{2, Float32, Point2f,
30+
Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f, Point2f}, TupleView{Tuple{Point2f, Point2f}, 2, 1, Vector{Point2f}}, false}},
31+
Vector{LineString{2, Float32, Point2f, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f, Point2f}, TupleView{Tuple{Point2f, Point2f}, 2, 1, Vector{Point2f}}, false}}}},))
3232
else
33-
@warnpcfail precompile(triangle_mesh, (Polygon{2, Float32, Point2f0, LineString{2, Float32, Point2f0,
34-
Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}}},
35-
Vector{LineString{2, Float32, Point2f0, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}}}}},))
33+
@warnpcfail precompile(triangle_mesh, (Polygon{2, Float32, Point2f, LineString{2, Float32, Point2f,
34+
Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f, Point2f}, TupleView{Tuple{Point2f, Point2f}, 2, 1, Vector{Point2f}}}},
35+
Vector{LineString{2, Float32, Point2f, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f, Point2f}, TupleView{Tuple{Point2f, Point2f}, 2, 1, Vector{Point2f}}}}}},))
3636
end
3737

38-
@warnpcfail precompile(split_intersections, (Vector{Point2f0},))
38+
@warnpcfail precompile(split_intersections, (Vector{Point2f},))
3939
end

src/primitives/rectangles.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ function Rect2D(xy::NamedTuple{(:x, :y)}, wh::NamedTuple{(:width, :height)})
147147
end
148148

149149
function FRect3D(x::Tuple{Tuple{<:Number,<:Number},Tuple{<:Number,<:Number}})
150-
return FRect3D(Vec3f0(x[1]..., 0), Vec3f0(x[2]..., 0))
150+
return FRect3D(Vec3f(x[1]..., 0), Vec3f(x[2]..., 0))
151151
end
152152

153153
function FRect3D(x::Tuple{Tuple{<:Number,<:Number,<:Number},
154154
Tuple{<:Number,<:Number,<:Number}})
155-
return FRect3D(Vec3f0(x[1]...), Vec3f0(x[2]...))
155+
return FRect3D(Vec3f(x[1]...), Vec3f(x[2]...))
156156
end
157157

158158
origin(prim::Rect) = prim.origin

src/primitives/spheres.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function coordinates(s::Circle, nvertices=64)
4848
end
4949

5050
function texturecoordinates(s::Circle, nvertices=64)
51-
return coordinates(Circle(Point2f0(0.5), 0.5f0), nvertices)
51+
return coordinates(Circle(Point2f(0.5), 0.5f0), nvertices)
5252
end
5353

5454
function coordinates(s::Sphere, nvertices=24)

src/viewtypes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ FaceView enables to link one array of points via a face array, to generate one
109109
abstract array of elements.
110110
E.g., this becomes possible:
111111
```
112-
x = FaceView(rand(Point3f0, 10), TriangleFace[(1, 2, 3), (2, 4, 5), ...])
112+
x = FaceView(rand(Point3f, 10), TriangleFace[(1, 2, 3), (2, 4, 5), ...])
113113
x[1] isa Triangle == true
114114
x isa AbstractVector{<: Triangle} == true
115115
# This means we can use it as a mesh:

test/geometrytypes.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Test, GeometryBasics
22

33
@testset "Cylinder" begin
44
@testset "constructors" begin
5-
o, extr, r = Point2f0(1, 2), Point2f0(3, 4), 5.0f0
5+
o, extr, r = Point2f(1, 2), Point2f(3, 4), 5.0f0
66
s = Cylinder(o, extr, r)
77
@test typeof(s) == Cylinder{2,Float32}
88
@test typeof(s) == Cylinder2{Float32}
@@ -13,7 +13,7 @@ using Test, GeometryBasics
1313
h = norm(o - extr)
1414
@test isapprox(height(s), h)
1515
#@test norm(direction(s) - Point{2,Float32}([2,2]./norm([1,2]-[3,4])))<1e-5
16-
@test isapprox(direction(s), Point2f0(2, 2) ./ h)
16+
@test isapprox(direction(s), Point2f(2, 2) ./ h)
1717
v1 = rand(Point{3,Float64})
1818
v2 = rand(Point{3,Float64})
1919
R = rand()
@@ -30,14 +30,14 @@ using Test, GeometryBasics
3030

3131
@testset "decompose" begin
3232

33-
o, extr, r = Point2f0(1, 2), Point2f0(3, 4), 5.0f0
33+
o, extr, r = Point2f(1, 2), Point2f(3, 4), 5.0f0
3434
s = Cylinder(o, extr, r)
3535
positions = Point{3,Float32}[(-0.7677671, 3.767767, 0.0),
3636
(2.767767, 0.23223293, 0.0),
3737
(0.23223293, 4.767767, 0.0),
3838
(3.767767, 1.2322329, 0.0), (1.2322329, 5.767767, 0.0),
3939
(4.767767, 2.232233, 0.0)]
40-
@test decompose(Point3f0, Tesselation(s, (2, 3))) positions
40+
@test decompose(Point3f, Tesselation(s, (2, 3))) positions
4141

4242
FT = TriangleFace{Int}
4343
faces = FT[(1, 2, 4), (1, 4, 3), (3, 4, 6), (3, 6, 5)]
@@ -77,7 +77,7 @@ using Test, GeometryBasics
7777
@test m isa GLNormalMesh
7878

7979
muv = uv_mesh(s)
80-
@test Rect(Point.(texturecoordinates(muv))) == FRect2D(Vec2f0(0), Vec2f0(1.0))
80+
@test Rect(Point.(texturecoordinates(muv))) == FRect2D(Vec2f(0), Vec2f(1.0))
8181
end
8282
end
8383

@@ -86,7 +86,7 @@ end
8686
pt_expa = Point{2,Int}[(0, 0), (1, 0), (0, 1), (1, 1)]
8787
@test decompose(Point{2,Int}, a) == pt_expa
8888
mesh = normal_mesh(a)
89-
@test decompose(Point2f0, mesh) == pt_expa
89+
@test decompose(Point2f, mesh) == pt_expa
9090

9191
b = Rect(Vec(1, 1, 1), Vec(1, 1, 1))
9292
pt_expb = Point{3,Int64}[[1, 1, 1], [1, 1, 2], [1, 2, 2], [1, 2, 1], [1, 1, 1],
@@ -140,7 +140,7 @@ end
140140
end
141141

142142
@testset "HyperSphere" begin
143-
sphere = Sphere{Float32}(Point3f0(0), 1.0f0)
143+
sphere = Sphere{Float32}(Point3f(0), 1.0f0)
144144

145145
points = decompose(Point, Tesselation(sphere, 3))
146146
point_target = Point{3,Float32}[[0.0, 0.0, 1.0], [1.0, 0.0, 6.12323e-17],
@@ -155,12 +155,12 @@ end
155155
face_target = TriangleFace{Int}[[1, 2, 5], [1, 5, 4], [2, 3, 6], [2, 6, 5], [4, 5, 8],
156156
[4, 8, 7], [5, 6, 9], [5, 9, 8]]
157157
@test f == face_target
158-
circle = Circle(Point2f0(0), 1.0f0)
159-
points = decompose(Point2f0, Tesselation(circle, 20))
158+
circle = Circle(Point2f(0), 1.0f0)
159+
points = decompose(Point2f, Tesselation(circle, 20))
160160
@test length(points) == 20
161161
tess_circle = Tesselation(circle, 32)
162162
mesh = triangle_mesh(tess_circle)
163-
@test decompose(Point2f0, mesh) decompose(Point2f0, tess_circle)
163+
@test decompose(Point2f, mesh) decompose(Point2f, tess_circle)
164164
end
165165

166166
@testset "Rectangles" begin
@@ -171,8 +171,8 @@ end
171171
@test (rect - 4) == FRect2D(-4, 3, 20, 3)
172172
@test (rect - Vec(2, -2)) == FRect2D(-2, 9, 20, 3)
173173

174-
base = Vec3f0(1, 2, 3)
175-
wxyz = Vec3f0(-2, 4, 2)
174+
base = Vec3f(1, 2, 3)
175+
wxyz = Vec3f(-2, 4, 2)
176176
rect = FRect3D(base, wxyz)
177177
@test (rect + 4) == FRect3D(base .+ 4, wxyz)
178178
@test (rect + Vec(2, -2, 3)) == FRect3D(base .+ Vec(2, -2, 3), wxyz)
@@ -184,8 +184,8 @@ end
184184
@test (rect * 4) == FRect2D(0, 7 * 4, 20 * 4, 3 * 4)
185185
@test (rect * Vec(2, -2)) == FRect2D(0, -7 * 2, 20 * 2, -3 * 2)
186186

187-
base = Vec3f0(1, 2, 3)
188-
wxyz = Vec3f0(-2, 4, 2)
187+
base = Vec3f(1, 2, 3)
188+
wxyz = Vec3f(-2, 4, 2)
189189
rect = FRect3D(base, wxyz)
190190
@test (rect * 4) == FRect3D(base .* 4, wxyz .* 4)
191191
@test (rect * Vec(2, -2, 3)) == FRect3D(base .* Vec(2, -2, 3), wxyz .* Vec(2, -2, 3))

0 commit comments

Comments
 (0)