| 2235 | } |
| 2236 | |
| 2237 | ImPlot3DPoint 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 | |
| 2255 | ImVec2 NDCToPixels(const ImPlot3DPoint& point) { |
| 2256 | ImPlot3DContext& gp = *GImPlot3D; |
no test coverage detected