Skip to content

Commit 68c95df

Browse files
committed
Replace f0 suffix with f
1 parent 8747437 commit 68c95df

File tree

12 files changed

+110
-90
lines changed

12 files changed

+110
-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/deprecated.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Base: @deprecate_binding
2+
3+
# Types ...f0 renamed to ...f
4+
@deprecate_binding Vecf0 Vecf
5+
@deprecate_binding Pointf0 Pointf
6+
for i in 1:4
7+
for T in [:Point, :Vec]
8+
oldname = Symbol("$T$(i)f0")
9+
newname = Symbol("$T$(i)f")
10+
@eval begin
11+
@deprecate_binding $oldname $newname
12+
end
13+
end
14+
oldname = Symbol("Mat$(i)f0")
15+
newname = Symbol("Mat$(i)f")
16+
@eval begin
17+
@deprecate_binding $oldname $newname
18+
end
19+
end

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:

0 commit comments

Comments
 (0)