I am trying to initialize an empty GeometryBasics.Point{2, Float32}, could anyone help?
What would a point without coordinates look like? How do you want to use it?
I think is just point = Point2f0[]
.
You can’t initialize an empty point, but you can initialize an empty array of points, which is what @lazarusA suggested.
Note that with the latest version it’s now Point2f[]
.
thank you!
is there document of Point2f function? was trying to search but didn’t find it…
Note that that is a syntax sugar for
GeometryBasics.Point{2, Float32}[]
It is not something different. Maybe that was not clear.
GeometryBasics is still underdocumented unfortunately. As pointed by @lmiq Point2f
is an alias for Point{2, Float32}
. You can see this easily in the REPL:
julia> Point2f
Point{2, Float32}
Typing ?Point2f
or ?Point
shows the help:
help?> Point2f
search: Point2f Point2 Pointf Point4f Point3f Point1f Point4 Point3 Point1 Point pointer PointMeta pointmeta PointWithUV
No documentation found.
Summary
≡≡≡≡≡≡≡≡≡
struct Point{S, T}
...
So although there is no documentation written for Point
, we can see it’s the name of a struct type. The type name can be used as a function to instantiate the type, it’s called a constructor (see the manual here). But when you write Point2f[]
you don’t use Point2f
as a function (constructor), but simply as a type name, just like we write Int[]
to declare an empty array of Int
.