Mercurial > repos > public > sbplib_julia
comparison test/Grids/geometry_test.jl @ 2011:d0b6c63c506e feature/grids/geometry_functions
Add Arc type for representing partial circles
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 07 May 2025 08:38:35 +0200 |
| parents | cf0fa2967361 |
| children | 4617e4b74b82 |
comparison
equal
deleted
inserted
replaced
| 2010:cf0fa2967361 | 2011:d0b6c63c506e |
|---|---|
| 1 using Diffinitive.Grids | 1 using Diffinitive.Grids |
| 2 using Diffinitive.Grids: Line, LineSegment, linesegments, polygon_edges, Circle, TransfiniteInterpolationSurface, check_transfiniteinterpolation | 2 using Diffinitive.Grids: Line, LineSegment, linesegments, polygon_edges, Circle, TransfiniteInterpolationSurface, check_transfiniteinterpolation, arc, Arc |
| 3 using StaticArrays | 3 using StaticArrays |
| 4 | 4 |
| 5 @testset "Line" begin | 5 @testset "Line" begin |
| 6 @testset "Constructors" begin | 6 @testset "Constructors" begin |
| 7 @test Line([1,2],[2,3]) isa Line{SVector{2,Int}} | 7 @test Line([1,2],[2,3]) isa Line{SVector{2,Int}} |
| 160 @test Grids.jacobian(c, 3π/2) ≈ [2,0] | 160 @test Grids.jacobian(c, 3π/2) ≈ [2,0] |
| 161 @test Grids.jacobian(c, π/4) ≈ [-√(2),√(2)] | 161 @test Grids.jacobian(c, π/4) ≈ [-√(2),√(2)] |
| 162 end | 162 end |
| 163 end | 163 end |
| 164 | 164 |
| 165 @testset "Arc" begin | |
| 166 @test Arc(Circle([0,0], 1), 0, 1) isa Arc{SVector{2,Int}, Int} | |
| 167 @test Arc(Circle([0,0], 1.), 0, 1) isa Arc{SVector{2,Int}, Float64} | |
| 168 @test Arc(Circle([1., 1.], 1), 0., 1.) isa Arc{SVector{2,Float64}, Float64} | |
| 169 @test Arc(Circle([1., 1.], 1), 0, 1) isa Arc{SVector{2,Float64}, Int} | |
| 170 @test Arc(Circle([1., 1.], 1), 0, 1.) isa Arc{SVector{2,Float64}, Float64} | |
| 171 | |
| 172 a = Arc(Circle([0,0], 1), 0, π/2) | |
| 173 @test a(0) ≈ [1,0] | |
| 174 @test a(1/3) ≈ [√(3)/2,1/2] | |
| 175 @test a(1/2) ≈ [1/√(2),1/√(2)] | |
| 176 @test a(2/3) ≈ [1/2, √(3)/2] | |
| 177 @test a(1) ≈ [0,1] | |
| 178 | |
| 179 @testset "Grids.jacobian" begin | |
| 180 @test_broken false | |
| 181 end | |
| 182 end | |
| 183 | |
| 165 @testset "TransfiniteInterpolationSurface" begin | 184 @testset "TransfiniteInterpolationSurface" begin |
| 166 @testset "Constructors" begin | 185 @testset "Constructors" begin |
| 167 @test TransfiniteInterpolationSurface(t->[1,2], t->[2,1], t->[0,0], t->[1,1]) isa TransfiniteInterpolationSurface | 186 @test TransfiniteInterpolationSurface(t->[1,2], t->[2,1], t->[0,0], t->[1,1]) isa TransfiniteInterpolationSurface |
| 168 | 187 |
| 169 cs = polygon_edges([0,0],[1,0],[1,1],[0,1]) | 188 cs = polygon_edges([0,0],[1,0],[1,1],[0,1]) |
