From 9add48653791264e8eaafa15c8dece6e67e954fb Mon Sep 17 00:00:00 2001 From: spaette Date: Fri, 20 Dec 2024 10:13:26 -0600 Subject: [PATCH] typos --- docs/src/primitives.md | 6 +++--- src/basic_types.jl | 2 +- src/boundingboxes.jl | 2 +- src/interfaces.jl | 4 ++-- src/meshes.jl | 12 ++++++------ src/primitives/rectangles.jl | 16 ++++++++-------- src/triangulation.jl | 2 +- src/viewtypes.jl | 2 +- test/meshes.jl | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/src/primitives.md b/docs/src/primitives.md index 6d094ede..b4ec3a30 100644 --- a/docs/src/primitives.md +++ b/docs/src/primitives.md @@ -132,10 +132,10 @@ end ``` To connect these points into a mesh, we need to generate a set of faces. -The faces of a prallelepiped are parallelograms, which we can describe with `QuadFace`. -Here we should be concious of the winding direction of faces. +The faces of a parallelepiped are parallelograms, which we can describe with `QuadFace`. +Here we should be conscious of the winding direction of faces. They are often used to determine the front vs the backside of a (2D) face. -For example GeometryBasics normal generation and OpenGL's backface culling assume a counter-clockwise windig direction to correspond to a front-facing face. +For example GeometryBasics normal generation and OpenGL's backface culling assume a counter-clockwise winding direction to correspond to a front-facing face. This means that if we look at a face from outside the shape, the positions referred to by that face should be ordered counter-clockwise. With that in mind the faces of our primitive become: diff --git a/src/basic_types.jl b/src/basic_types.jl index d2623940..c0c14020 100644 --- a/src/basic_types.jl +++ b/src/basic_types.jl @@ -626,7 +626,7 @@ texturecoordinates(mesh::Mesh) = hasproperty(mesh, :uv) ? mesh.uv : nothing """ vertex_attributes(mesh::Mesh) -Returns a dictionairy containing the vertex attributes of the given mesh. +Returns a dictionary containing the vertex attributes of the given mesh. Mutating these will change the mesh. """ vertex_attributes(mesh::Mesh) = getfield(mesh, :vertex_attributes) diff --git a/src/boundingboxes.jl b/src/boundingboxes.jl index 447a7228..212886dc 100644 --- a/src/boundingboxes.jl +++ b/src/boundingboxes.jl @@ -5,7 +5,7 @@ end """ Rect(points::AbstractArray{<: Point}) -Construct a bounding box countaining all the given points. +Construct a bounding box containing all the given points. """ function Rect{N1,T1}(geometry::AbstractArray{PT}) where {N1,T1,PT<:Point} N2, T2 = length(PT), eltype(PT) diff --git a/src/interfaces.jl b/src/interfaces.jl index cd77348d..ea989003 100644 --- a/src/interfaces.jl +++ b/src/interfaces.jl @@ -35,7 +35,7 @@ function normals(primitive, nvertices=nothing; kw...) # doesn't have any specific algorithm to generate normals # so will be generated from faces + positions # which we indicate by returning nothing! - # Overload normals(primitive::YourPrimitive), to calcalute the normals + # Overload normals(primitive::YourPrimitive), to calculate the normals # differently return nothing end @@ -127,7 +127,7 @@ Normal() = Normal(Vec3f) decompose(::Type{TargetType}, primitive) decompose(::Type{TargetType}, data::AbstractVector) -Dependent on the given type, extracts data from the primtive and converts its +Dependent on the given type, extracts data from the primitive and converts its eltype to `TargetType`. Possible `TargetType`s: diff --git a/src/meshes.jl b/src/meshes.jl index dc27e348..ab5a38e1 100644 --- a/src/meshes.jl +++ b/src/meshes.jl @@ -134,7 +134,7 @@ facetype(::Mesh{D, T, FT}) where {D, T, FT} = FT 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. +`pointtype`, `facetype` and `uvtype` are set by the corresponding keyword arguments. See also: [`triangle_mesh`](@ref), [`normal_mesh`](@ref), [`uv_mesh`](@ref), [`uv_normal_mesh`](@ref) """ @@ -154,7 +154,7 @@ end 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. +by the corresponding keyword arguments. See also: [`triangle_mesh`](@ref), [`normal_mesh`](@ref), [`uv_mesh`](@ref), [`uv_normal_mesh`](@ref) """ @@ -175,7 +175,7 @@ end 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. +by the corresponding keyword arguments. See also: [`triangle_mesh`](@ref), [`normal_mesh`](@ref), [`uv_mesh`](@ref), [`uv_normal_mesh`](@ref) """ @@ -192,7 +192,7 @@ end 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. +by the corresponding keyword arguments. See also: [`triangle_mesh`](@ref), [`normal_mesh`](@ref), [`uv_mesh`](@ref), [`uv_normal_mesh`](@ref) """ @@ -333,7 +333,7 @@ end expand_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 +mesh that contains no FaceViews, reordering and duplicating vertex attributes as necessary. If the mesh has `views` they will be adjusted as needed to produce the same submeshes. """ @@ -417,7 +417,7 @@ function merge_vertex_indices( # indices that remap attributes attribute_indices = ntuple(n -> sizehint!(UInt32[], N_faces), N_Attrib) - # keep track of the remmaped indices for one vertex so we don't have to + # keep track of the remapped indices for one vertex so we don't have to # query the dict twice temp = Vector{T}(undef, N) diff --git a/src/primitives/rectangles.jl b/src/primitives/rectangles.jl index fa6d0aa5..a5df471f 100644 --- a/src/primitives/rectangles.jl +++ b/src/primitives/rectangles.jl @@ -3,7 +3,7 @@ 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 +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. """ struct HyperRectangle{N,T} <: GeometryPrimitive{N,T} @@ -17,7 +17,7 @@ end """ const Rect{N,T} = HyperRectangle{N,T} -A rectangle in N dimensions, formally the cartesian product of intervals. See also [`HyperRectangle`](@ref). Its aliases are +A rectangle in N dimensions, formally the Cartesian product of intervals. See also [`HyperRectangle`](@ref). Its aliases are | |`T`(eltype)|`Float64` |`Float32` |`Int` | |--------|-----------|----------|----------|----------| @@ -216,12 +216,12 @@ function Base.:(*)(m::Mat{N1,N1,T1}, h::Rect{N2,T2}) where {N1,N2,T1,T2} # get all points on the Rect d = decompose(Point, h) - # make sure our points are sized for the tranform + # make sure our points are sized for the transform pts = (Vec{N1,T}[vcat(pt, ones(Vec{D,T})) for pt in d]...,)::NTuple{2^N2,Vec{N1,T}} vmin = Vec{N1,T}(typemax(T)) vmax = Vec{N1,T}(typemin(T)) - # tranform all points, tracking min and max points + # transform all points, tracking min and max points for pt in pts pn = m * pt vmin = min.(pn, vmin) @@ -239,11 +239,11 @@ function Base.:(*)(m::Mat{N,N,T1}, h::Rect{N,T2}) where {N,T1,T2} # get all points on the Rect pts = decompose(Point, h) - # make sure our points are sized for the tranform + # make sure our points are sized for the transform vmin = Vec{N,T}(typemax(T)) vmax = Vec{N,T}(typemin(T)) - # tranform all points, tracking min and max points + # transform all points, tracking min and max points for pt in pts pn = m * Vec(pt) vmin = min.(pn, vmin) @@ -262,13 +262,13 @@ function Base.:(*)(m::Mat{4,4,T}, h::Rect{3,T}) where {T} Vec{4,T}(0.0, 0.0, 1.0, 1.0), Vec{4,T}(1.0, 0.0, 1.0, 1.0), Vec{4,T}(0.0, 1.0, 1.0, 1.0), Vec{4,T}(1.0, 1.0, 1.0, 1.0)) - # make sure our points are sized for the tranform + # make sure our points are sized for the transform vmin = Vec{4,T}(typemax(T)) vmax = Vec{4,T}(typemin(T)) o, w = origin(h), widths(h) _o = Vec{4,T}(o[1], o[2], o[3], T(0)) _w = Vec{4,T}(w[1], w[2], w[3], T(1)) - # tranform all points, tracking min and max points + # transform all points, tracking min and max points for pt in pts pn = m * (_o + (pt .* _w)) vmin = min.(pn, vmin) diff --git a/src/triangulation.jl b/src/triangulation.jl index 1847f9b5..b0dbc3cf 100644 --- a/src/triangulation.jl +++ b/src/triangulation.jl @@ -168,7 +168,7 @@ function decompose(::Type{F}, points::AbstractVector{<:Point}) where {F<:Abstrac t += 1 end nv -= 1 - #= resest error detection counter =# + #= reset error detection counter =# count = 2 * nv end end diff --git a/src/viewtypes.jl b/src/viewtypes.jl index 41937a39..0f531036 100644 --- a/src/viewtypes.jl +++ b/src/viewtypes.jl @@ -60,7 +60,7 @@ end 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. +Between each polytope, `skip` elements are skipped until the next starts. Example: ```julia x = connect(Point[(1, 2), (3, 4), (5, 6), (7, 8)], Line, 2) diff --git a/test/meshes.jl b/test/meshes.jl index 6265231d..f15ad37b 100644 --- a/test/meshes.jl +++ b/test/meshes.jl @@ -119,7 +119,7 @@ end @test faces(m) == fs end - @testset "Verifaction" begin + @testset "Verification" begin # enough vertices present @test_throws ErrorException Mesh(rand(Point2f, 7), fs) m = Mesh(rand(Point2f, 12), fs)