MCPcopy Create free account
hub / github.com/brenocq/implot3d / NDCToPixels

Function NDCToPixels

implot3d.cpp:1186–1194  ·  view source on GitHub ↗

Convert a position in the plot's NDC to pixels

Source from the content-addressed store, hash-verified

1184
1185// Convert a position in the plot's NDC to pixels
1186ImVec2 NDCToPixels(const ImPlot3DPlot& plot, const ImPlot3DPoint& point) {
1187 ImVec2 center = plot.PlotRect.GetCenter();
1188 ImPlot3DPoint point_pix = plot.GetViewScale() * (plot.Rotation * point);
1189 point_pix.y *= -1.0f; // Invert y-axis
1190 point_pix.x += center.x;
1191 point_pix.y += center.y;
1192
1193 return ImVec2((float)point_pix.x, (float)point_pix.y);
1194}
1195
1196// Convert a position in the plot's coordinate system to the plot's normalized device coordinate system (NDC)
1197ImPlot3DPoint PlotToNDC(const ImPlot3DPlot& plot, const ImPlot3DPoint& point) {

Callers 2

RenderTickMarksFunction · 0.85
PlotToPixelsFunction · 0.85

Calls 2

SetupLockFunction · 0.85
GetViewScaleMethod · 0.80

Tested by

no test coverage detected