-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInit_Obstacle.jl
50 lines (35 loc) · 1.91 KB
/
Init_Obstacle.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#Init the Obstacles
function Create_Geometry(x_Elements::Vector{NTuple{2, Float64}}, l_Elements::Vector{Float64})
geometry([element(x_Elements[i], l_Elements[i]) for i in 1:length(x_Elements)])
end
function Create_Corridor_with_Obstacle(width, laenge, l, Δx, l_obs)
geometry_y = vcat(zeros(length(LinRange(0:Δx:laenge))), fill(width, length(LinRange(0:Δx:laenge))), width/2)
geometry_x = vcat(LinRange(0:Δx:laenge), LinRange(0:Δx:laenge), laenge/2)
ls = fill(l, length(geometry_x))
ls[end] = l_obs
geometry([element((geometry_x[i], geometry_y[i]), ls[i]) for i in 1:length(geometry_x)])
end
function Create_Corridor_with_Obstacle(x0, width, laenge, l, Δx, l_obs)
geometry_y = vcat(zeros(length(LinRange(0:Δx:laenge))), fill(width, length(LinRange(0:Δx:laenge))), width/2)
geometry_x = vcat(LinRange(0:Δx:laenge), LinRange(0:Δx:laenge), laenge/2)
geometry_x = geometry_x .+ x0[1]
geometry_y = geometry_y .+ x0[2]
ls = fill(l, length(geometry_x))
ls[end] = l_obs
geometry([element((geometry_x[i], geometry_y[i]), ls[i]) for i in 1:length(geometry_x)])
end
function Create_Corridor(x0, width, laenge, l, Δx)
geometry_y = vcat(zeros(length(LinRange(0:Δx:laenge))), fill(width, length(LinRange(0:Δx:laenge))))
geometry_x = vcat(LinRange(0:Δx:laenge), LinRange(0:Δx:laenge))
geometry_x = geometry_x .+ x0[1]
geometry_y = geometry_y .+ x0[2]
ls = fill(l, length(geometry_x))
geometry([element((geometry_x[i], geometry_y[i]), ls[i]) for i in 1:length(geometry_x)])
end
function Create_Corner(laenge, l, Δx)
geometry_y = vcat(fill(laenge, length(LinRange(0:Δx:laenge))), LinRange(laenge:-Δx:0))
geometry_x = vcat(LinRange(0:Δx:laenge), fill(laenge, length(LinRange(laenge:-Δx:0))))
geometry_y = -geometry_y .+ 5
geometry_x = -geometry_x .+ 5
geometry([element((geometry_x[i], geometry_y[i]), l) for i in 1:length(geometry_x)])
end