Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

implot3d.internal (C++)

ImPlot3D’s internal API (implot3d_internal.h): the structures and helpers that ImPlot3D is built with.

The C++ API of ImPlot3D as it is bound to Python: the entries of the module imgui_bundle.implot3d.internal, in the same order, with their C++ signatures and the headers’ comments. From the stubs: the functions excluded from the bindings, the typedefs and the macros are absent.

implot3d_internal.h

ImPlot3D::ImLog10

static inline double ImLog10(double x);

Computes the common (base-10) logarithm (private API)

ImPlot3D::ImSinh

static inline double ImSinh(double x);

Computes the hyperbolic sine (private API)

ImPlot3D::ImAsinh

static inline double ImAsinh(double x);

Computes the inverse hyperbolic sine (private API)

Flips a flag in a flagset

ImPlot3D::ImPosMod

static inline int ImPosMod(int l, int r);

Returns always positive modulo (assumes r != 0) (private API)

ImPlot3D::ImNan

static inline bool ImNan(double val);

Returns True if val is NAN (private API)

ImPlot3D::ImNanOrInf

static inline bool ImNanOrInf(double val);

Returns True if val is NAN or INFINITY (private API)

ImPlot3D::ImConstrainNan

static inline double ImConstrainNan(double val);

Turns NANs to 0s (private API)

ImPlot3D::ImConstrainInf

static inline double ImConstrainInf(double val);

Turns infinity to floating point maximums
Clamped to half DBL_MAX to prevent overflow in size calculations (Max - Min) (private API)

ImPlot3D::ImAlmostEqual

static inline bool ImAlmostEqual(double v1, double v2, int ulp = 2);

True if two numbers are approximately equal using units in the last place. (private API)

ImPlot3D::ImAlphaU32

static inline ImU32 ImAlphaU32(ImU32 col, float alpha);

Set alpha channel of 32-bit color from float in range [0.0 1.0] (private API)

ImPlot3D::ImMixU32

static inline ImU32 ImMixU32(ImU32 a, ImU32 b, ImU32 s);

Mix color a and b by factor s in [0 256] (private API)

Internal Enumerations

MarkerInternal_ (enum)

MemberValue
ImPlot3DMarker_Invalid = -3, }-3

NextItemData (struct)

Member
ImPlot3DSpec Spec;
bool RenderLine;
bool RenderFill;
bool RenderMarkerLine;
bool RenderMarkerFill;
bool IsAutoFill;
bool IsAutoLine;
bool Hidden;
NextItemData::ImPlot3DNextItemData
ImPlot3DNextItemData();
NextItemData::Reset
void Reset();

(private API)

ColormapData (struct)

Colormap data storage

Member
int Count;
ColormapData::ImPlot3DColormapData
ImPlot3DColormapData();
ColormapData::Append
int Append(const char* name, const ImU32* keys, int count, bool qual);

(private API)

ColormapData::RebuildTables
void RebuildTables();

(private API)

ColormapData::IsQual
inline bool IsQual(ImPlot3DColormap cmap) const;

(private API)

ColormapData::GetName
inline const char* GetName(ImPlot3DColormap cmap) const;

(private API)

ColormapData::GetIndex
inline ImPlot3DColormap GetIndex(const char* name) const;

(private API)

ColormapData::GetKeys
inline const ImU32* GetKeys(ImPlot3DColormap cmap) const;

(private API)

ColormapData::GetKeyCount
inline int GetKeyCount(ImPlot3DColormap cmap) const;

(private API)

ColormapData::GetKeyColor
inline ImU32 GetKeyColor(ImPlot3DColormap cmap, int idx) const;

(private API)

ColormapData::SetKeyColor
inline void SetKeyColor(ImPlot3DColormap cmap, int idx, ImU32 value);

(private API)

ColormapData::GetTable
inline const ImU32* GetTable(ImPlot3DColormap cmap) const;

(private API)

ColormapData::GetTableSize
inline int GetTableSize(ImPlot3DColormap cmap) const;

(private API)

ColormapData::GetTableColor
inline ImU32 GetTableColor(ImPlot3DColormap cmap, int idx) const;

(private API)

ColormapData::LerpTable
inline ImU32 LerpTable(ImPlot3DColormap cmap, float t) const;

(private API)

Item (struct)

State information for plot items

Member
ImGuiID ID;
ImU32 Color;
ImPlot3DMarker Marker;
int NameOffset;
bool Show;
bool LegendHovered;
bool SeenThisFrame;
Item::ImPlot3DItem
ImPlot3DItem();

Legend (struct)

Holds legend state

Member
ImPlot3DLegendFlags Flags;
ImPlot3DLegendFlags PreviousFlags;
ImPlot3DLocation Location;
ImPlot3DLocation PreviousLocation;
ImVec2 Scroll;
ImRect Rect;
ImRect RectClamped;
bool Hovered;
bool Held;
Legend::ImPlot3DLegend
ImPlot3DLegend();
Legend::Reset
void Reset();

(private API)

ItemGroup (struct)

Holds items

Member
ImGuiID ID;
ImPlot3DLegend Legend;
int ColormapIdx;
ImPlot3DMarker MarkerIdx;
ItemGroup::ImPlot3DItemGroup
ImPlot3DItemGroup();
ItemGroup::GetItemCount
int GetItemCount() const;

(private API)

ItemGroup::GetItemID
ImGuiID GetItemID(const char* label_id);

(private API)

ItemGroup::GetItem
ImPlot3DItem* GetItem(ImGuiID id);
ImPlot3DItem* GetItem(const char* label_id);

(private API)

ItemGroup::GetOrAddItem
ImPlot3DItem* GetOrAddItem(ImGuiID id);

(private API)

ItemGroup::GetItemByIndex
ImPlot3DItem* GetItemByIndex(int i);

(private API)

ItemGroup::GetItemIndex
int GetItemIndex(ImPlot3DItem* item);

(private API)

ItemGroup::GetLegendCount
int GetLegendCount() const;

(private API)

ItemGroup::GetLegendItem
ImPlot3DItem* GetLegendItem(int i);

(private API)

ItemGroup::GetLegendLabel
const char* GetLegendLabel(int i);

(private API)

ItemGroup::Reset
void Reset();

(private API)

Tick (struct)

Tick mark info

Member
double PlotPos;
bool Major;
bool ShowLabel;
ImVec2 LabelSize;
int TextOffset;
int Idx;
Tick::ImPlot3DTick
ImPlot3DTick(double value, bool major, bool show_label);

Ticker (struct)

Collection of ticks

Ticker::ImPlot3DTicker
ImPlot3DTicker();
Ticker::AddTick
ImPlot3DTick& AddTick(double value, bool major, bool show_label, const char* label);
inline ImPlot3DTick& AddTick(ImPlot3DTick tick);

(private API)

Ticker::GetText
const char* GetText(int idx) const;
const char* GetText(const ImPlot3DTick& tick) const;

(private API)

Ticker::Reset
void Reset();

(private API)

Ticker::TickCount
int TickCount() const;

(private API)

Axis (struct)

Holds axis information

Member
ImPlot3DAxisFlags Flags;
ImPlot3DAxisFlags PreviousFlags;
ImPlot3DRange Range;
ImPlot3DCond RangeCond;
double NDCScale;
ImPlot3DScale Scale;
ImPlot3DTicker Ticker;
void* FormatterData;
bool ShowDefaultTicks;
void* TransformData;Custom transform data set by the user
ImPlot3DRange ScaledRange;Cached scaled range values
bool FitThisFrame;
ImPlot3DRange FitExtents;
ImPlot3DRange ConstraintRange;
ImPlot3DRange ConstraintZoom;
bool Hovered;
bool Held;
ImU32 ColorBg;
ImU32 ColorHov;
ImU32 ColorAct;
Axis::ImPlot3DAxis
ImPlot3DAxis();

Constructor

Axis::Reset
inline void Reset();

(private API)

Axis::SetRange
inline void SetRange(double v1, double v2);

(private API)

Axis::SetMin
inline bool SetMin(double _min, bool force = false);

(private API)

Axis::SetMax
inline bool SetMax(double _max, bool force = false);

(private API)

Axis::Constrain
inline void Constrain();

(private API)

Axis::UpdateTransformCache
inline void UpdateTransformCache();

(private API)

Axis::PlotToNDC
inline double PlotToNDC(double plt) const;

(private API)

Axis::NDCToPlot
inline double NDCToPlot(double t) const;

(private API)

Axis::IsRangeLocked
inline bool IsRangeLocked() const;

(private API)

Axis::IsLockedMin
inline bool IsLockedMin() const;

(private API)

Axis::IsLockedMax
inline bool IsLockedMax() const;

(private API)

Axis::IsLocked
inline bool IsLocked() const;

(private API)

Axis::IsInputLockedMin
inline bool IsInputLockedMin() const;

(private API)

Axis::IsInputLockedMax
inline bool IsInputLockedMax() const;

(private API)

Axis::IsInputLocked
inline bool IsInputLocked() const;

(private API)

Axis::IsPanLocked
inline bool IsPanLocked(bool increasing);

(private API)

Axis::SetLabel
inline void SetLabel(const char* label);

(private API)

Axis::GetLabel
inline const char* GetLabel() const;

(private API)

Axis::NDCSize
inline double NDCSize() const;

(private API)

Axis::SetAspect
inline void SetAspect(double units_per_ndc_unit);

(private API)

Axis::GetAspect
double GetAspect() const;

(private API)

Axis::HasLabel
bool HasLabel() const;

(private API)

Axis::HasGridLines
bool HasGridLines() const;

(private API)

Axis::HasTickLabels
bool HasTickLabels() const;

(private API)

Axis::HasTickMarks
bool HasTickMarks() const;

(private API)

Axis::IsAutoFitting
bool IsAutoFitting() const;

(private API)

Axis::ExtendFit
void ExtendFit(double value);

(private API)

Axis::ApplyFit
void ApplyFit();

(private API)

Plot (struct)

Holds plot state information that must persist after EndPlot

Member
ImGuiID ID;
ImPlot3DFlags Flags;
ImPlot3DFlags PreviousFlags;
bool JustCreated;
bool Initialized;
ImRect FrameRect;Outermost bounding rectangle that encapsulates whole the plot/title/padding/etc
ImRect CanvasRect;Frame rectangle reduced by padding
ImRect PlotRect;Bounding rectangle for the actual plot area
ImPlot3DQuat InitialRotation;Initial rotation quaternion
ImPlot3DQuat Rotation;Current rotation quaternion
ImPlot3DCond RotationCond;
float AnimationTime;Remaining animation time
ImPlot3DQuat RotationAnimationEnd;End rotation for animation
bool SetupLocked;
bool Hovered;
bool Held;
int HeldEdgeIdx;Index of the edge being held
int HeldPlaneIdx;Index of the plane being held
ImPlot3DPoint DragRotationAxis;Axis of rotation for the duration of a drag
bool FitThisFrame;
ImPlot3DItemGroup Items;
bool ContextClick;True if context button was clicked (to distinguish from double click)
bool OpenContextThisFrame;
Plot::ImPlot3DPlot
ImPlot3DPlot();
Plot::SetTitle
inline void SetTitle(const char* title);

(private API)

Plot::HasTitle
inline bool HasTitle() const;

(private API)

Plot::GetTitle
inline const char* GetTitle() const;

(private API)

Plot::IsRotationLocked
inline bool IsRotationLocked() const;

(private API)

Plot::ExtendFit
void ExtendFit(const ImPlot3DPoint& point);

Extends the fit range of all three axes to include the provided point (private API)

Plot::RangeMin
ImPlot3DPoint RangeMin() const;

Returns the minimum of the range in all three dimensions (private API)

Plot::RangeMax
ImPlot3DPoint RangeMax() const;

Returns the maximum of the range in all three dimensions (private API)

Plot::RangeCenter
ImPlot3DPoint RangeCenter() const;

Returns the point at the center of the range in all three dimensions (private API)

Plot::SetRange
void SetRange(const ImPlot3DPoint& min, const ImPlot3DPoint& max);

Sets the range of all three axes (private API)

Plot::GetViewScale
float GetViewScale() const;

Returns the scale of the plot view (constant to convert from NDC coordinates to pixels coordinates) (private API)

Plot::GetBoxScale
ImPlot3DPoint GetBoxScale() const;

Returns the scale of the plot box in each dimension (private API)

Plot::ApplyEqualAspect
void ApplyEqualAspect(ImAxis3D ref_axis);

Applies equal aspect ratio constraint using the specified axis as reference.
Other axes are adjusted to match the reference axis’s aspect ratio (units per NDC unit). (private API)

Context (struct)

Member
ImPlot3DPlot* CurrentPlot;
ImPlot3DItemGroup* CurrentItems;
ImPlot3DItem* CurrentItem;
ImPlot3DNextItemData NextItemData;
ImPlot3DStyle Style;
ImPlot3DColormapData ColormapData;

Context Utils

ImPlot3D::InitializeContext

IMPLOT3D_API void InitializeContext(ImPlot3DContext* ctx);

Initialize ImPlot3DContext

ImPlot3D::ResetContext

IMPLOT3D_API void ResetContext(ImPlot3DContext* ctx);

Reset ImPlot3DContext

Style Utils

ImPlot3D::IsColorAuto

IMPLOT3D_API bool IsColorAuto(const ImVec4& col);
IMPLOT3D_API bool IsColorAuto(ImPlot3DCol idx);

ImPlot3D::GetAutoColor

IMPLOT3D_API ImVec4 GetAutoColor(ImPlot3DCol idx);

ImPlot3D::GetStyleColorName

IMPLOT3D_API const char* GetStyleColorName(ImPlot3DCol idx);

Returns white or black text given background color

ImPlot3D::CalcTextColor

static inline ImU32 CalcTextColor(const ImVec4& bg);
static inline ImU32 CalcTextColor(ImU32 bg);

(private API)

ImPlot3D::GetItemData

IMPLOT3D_API const ImPlot3DNextItemData& GetItemData();

Get styling data for next item (call between BeginItem/EndItem)

ImPlot3D::GetColormapColorU32

IMPLOT3D_API ImU32 GetColormapColorU32(int idx, ImPlot3DColormap cmap);

Returns a color from the Color map given an index >= 0 (modulo will be performed)

ImPlot3D::NextColormapColorU32

IMPLOT3D_API ImU32 NextColormapColorU32();

Returns the next unused colormap color and advances the colormap. Can be used to skip colors if desired

ImPlot3D::RenderColorBar

IMPLOT3D_API void RenderColorBar(const ImU32* colors, int size, ImDrawList& DrawList, const ImRect& bounds, bool vert, bool reversed, bool continuous);

Render a colormap bar

Item Utils

ImPlot3D::BeginItem

IMPLOT3D_API bool BeginItem(const char* label_id, const ImPlot3DSpec& spec = ImPlot3DSpec(), const ImVec4& item_col = IMPLOT3D_AUTO_COL, ImPlot3DMarker item_mkr = ImPlot3DMarker_Invalid);

Begins a new item. Returns False if the item should not be plotted

ImPlot3D::EndItem

IMPLOT3D_API void EndItem();

ImPlot3D::RegisterOrGetItem

IMPLOT3D_API ImPlot3DItem* RegisterOrGetItem(const char* label_id, ImPlot3DItemFlags flags, bool* just_created = nullptr);

Register or get an existing item from the current plot

ImPlot3D::GetCurrentItem

IMPLOT3D_API ImPlot3DItem* GetCurrentItem();

Gets the current item from ImPlot3DContext

ImPlot3D::BustItemCache

IMPLOT3D_API void BustItemCache();

Busts the cache for every item for every plot in the current context

ImPlot3D::AddTextRotated

IMPLOT3D_API void AddTextRotated(ImDrawList* draw_list, ImVec2 pos, float angle, ImU32 col, const char* text_begin, const char* text_end = nullptr);

TODO move to another place

Plot Utils

ImPlot3D::GetCurrentPlot

IMPLOT3D_API ImPlot3DPlot* GetCurrentPlot();

Gets the current plot from ImPlot3DContext

ImPlot3D::BustPlotCache

IMPLOT3D_API void BustPlotCache();

Busts the cache for every plot in the current context

ImPlot3D::GetFramePos

IMPLOT3D_API ImVec2 GetFramePos();

Get the current frame position (top-left) in pixels

ImPlot3D::GetFrameSize

IMPLOT3D_API ImVec2 GetFrameSize();

Get the current frame size in pixels

ImPlot3D::PlotToNDC

IMPLOT3D_API ImPlot3DPoint PlotToNDC(const ImPlot3DPoint& point);

Convert a position in the current plot’s coordinate system to the current plot’s normalized device coordinate system (NDC)
When the cube’s aspect ratio is [1,1,1], the NDC ranges from [-0.5, 0.5] along each axis

ImPlot3D::NDCToPlot

IMPLOT3D_API ImPlot3DPoint NDCToPlot(const ImPlot3DPoint& point);

ImPlot3D::NDCToPixels

IMPLOT3D_API ImVec2 NDCToPixels(const ImPlot3DPoint& point);

Convert a position in the current plot’s NDC to pixels

ImPlot3D::PixelsToNDCRay

IMPLOT3D_API ImPlot3DRay PixelsToNDCRay(const ImVec2& pix);

Convert a pixel coordinate to a ray in the NDC

ImPlot3D::NDCRayToPlotRay

IMPLOT3D_API ImPlot3DRay NDCRayToPlotRay(const ImPlot3DRay& ray);

Convert a ray in the NDC to a ray in the current plot’s coordinate system

Setup Utils

ImPlot3D::SetupLock

IMPLOT3D_API void SetupLock();

Transforms

ImPlot3D::TransformForward_Log10

static inline double TransformForward_Log10(double v, void*);

(private API)

ImPlot3D::TransformInverse_Log10

static inline double TransformInverse_Log10(double v, void*);

(private API)

ImPlot3D::TransformForward_SymLog

static inline double TransformForward_SymLog(double v, void*);

(private API)

ImPlot3D::TransformInverse_SymLog

static inline double TransformInverse_SymLog(double v, void*);

(private API)