Closed putianyi889 closed 6 months ago
Thank you! I'm thinking to add a float64 alias here as well here.
How should we call it? Rectf64
?
@jkrumbiegel, @ffreyer
Rectd
would be nice and consistent with OpenCV, Rhino, Java vecmath and Eigen (spirit of #61)...
Yeah, that was my favorite before people didn't want it for Point... Its a bit confusing because of d-> dim
, but if people agree on it, I'd be up for it.
Maybe Rectd2
is better than Rect2d
? But then we'd have to change all the Point2f
s to Pointf2
s as well
Maybe
Rectd2
is better thanRect2d
? But then we'd have to change all thePoint2f
s toPointf2
s as well
Is the concern that "Rect2d" reads like "2 dimensional rect"? I thought the same but I found it quite easy to get used to Point2d
, Vec2d
, Rect2d
. Some things to consider:
2
,d
sequence in Rect2d
corresponds to the sequence of type parameters: it's Rect{N,T}
not Rect{T,N}
. It's also natural to have the "smallest information" come last, i.e. Float32 vs Float64 is a smaller change than 2D vs 3D.Rect2f
, Rect2d
, Vec2d
, than Rectf2
, Rectd2
, Vecd2
. The digit gives a nice visual separation between the word and the f
or d
suffix.I suspect these two points are why most APIs use Rect2d
rather than Rectd2
.
Valid points, I agree
I think I like Rect2d more than Rect2f64 and Rectd2. Looks cleaner and is easier to type. The lower case d also kind of matches glsl/opengl and glm's dvec types. If we want to also use d for dimensions we could enforce that D to be upper case. "double" vs "Dimension". Or just write out "dim/Dim".
Is there stuff exported from Makie where the suffix 2d is currently used to mean two-dimensional?
Edit:
Not much
julia> filter(x -> endswith(string(x), r"2[dD]"), names(CairoMakie))
2-element Vector{Symbol}:
:Camera2D
:cam2d
I think it's internal, but we could still mention it shortly? But I wouldn't want to export it.
I guess this doc PR can be merged and new aliases can be introduced in a new PR if desired?
Yeah I was thinking about it and i was leaning towards merging it now :)
Looks good to me!