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

Function NDCToPlot

implot3d.cpp:2237–2253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2235}
2236
2237ImPlot3DPoint NDCToPlot(const ImPlot3DPoint& point) {
2238 ImPlot3DContext& gp = *GImPlot3D;
2239 IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr, "NDCToPlot() needs to be called between BeginPlot() and EndPlot()!");
2240 ImPlot3DPlot& plot = *gp.CurrentPlot;
2241 SetupLock();
2242
2243 ImPlot3DPoint plot_point;
2244 for (int i = 0; i < 3; i++) {
2245 ImPlot3DAxis& axis = plot.Axes[i];
2246 double ndc_range = 0.5 * axis.NDCScale;
2247 double ndc_point = point[i];
2248 double t = ImPlot3D::ImHasFlag(axis.Flags, ImPlot3DAxisFlags_Invert) ? (ndc_range - ndc_point) : (ndc_point + ndc_range);
2249 t /= axis.NDCScale;
2250 plot_point[i] = axis.NDCToPlot(t);
2251 }
2252 return plot_point;
2253}
2254
2255ImVec2 NDCToPixels(const ImPlot3DPoint& point) {
2256 ImPlot3DContext& gp = *GImPlot3D;

Callers 3

PixelsToPlotPlaneFunction · 0.85
NDCRayToPlotRayFunction · 0.85
HandleInputFunction · 0.85

Calls 3

SetupLockFunction · 0.85
ImHasFlagFunction · 0.85
NDCToPlotMethod · 0.80

Tested by

no test coverage detected