# Why are vertices of every LazySets.VPolygon or VPolytope given as 1 D Array and not based on the shape of the object?

``````A = rand(HPolyhedron,dim=3)
Av = tovrep(A)
Av.vertices
``````

gives an 11-element Array{Array{Float64,1},1} and not a 3 Dimensional array of 11 elements, also how can i convert these vertices to BasicGeometry.Point3d without using a loop?

Why are vertices […] given as 1 D Array and not based on the shape of the object?

I guess because it is simple to reason about a polytope described in vertex representation as a one-dimensional array of “vertices”. In LazySets there is a type `VPolygon` to deal with the two-dimensional case, which is special in many ways (e.g. lots of very efficient algorithms exist only for the 2D case). I don’t think there would be a practical benefit of adding the dimension as part of the type. (Please note that you can always instantiate such sets using statically sized arrays from `StaticArrays`, which do know the “shape” of the object in advance hence can benefit from lower-level optimizations.)

About the question on the shape, an array-of-arrays can be reshaped into a single array in different ways, e.g.

``````julia> using LazySets

julia> V = rand(VPolytope, dim=3);

julia> typeof(V)
VPolytope{Float64,Array{Float64,1}}

julia> vlist = vertices_list(V);  # array of arrays

julia> typeof(vlist)
Array{Array{Float64,1},1}

julia> length(vlist) # number of vertices
12

julia> R = reduce(hcat, vlist)
3×12 Array{Float64,2}:
...
``````

About the question on the package GeometryBasics.jl, evaluating `GeometryBasics.Point3` on each vertex should do it? (Why wouldn’t you use a loop?).

``````julia> P = [Point3(x) for x in vlist]
12-element Array{Point{3,Float64},1}:
...
``````

Hope this helps.