GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
graphics.cc File Reference
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <set>
#include <string>
#include <sstream>
#include "cmd-edit.h"
#include "file-ops.h"
#include "file-stat.h"
#include "lo-sysdep.h"
#include "oct-locbuf.h"
#include "oct-time.h"
#include "builtin-defun-decls.h"
#include "defun.h"
#include "display.h"
#include "error.h"
#include "gh-manager.h"
#include "graphics-utils.h"
#include "graphics.h"
#include "input.h"
#include "interpreter-private.h"
#include "interpreter.h"
#include "ov.h"
#include "ovl.h"
#include "oct-map.h"
#include "ov-fcn-handle.h"
#include "pager.h"
#include "text-engine.h"
#include "text-renderer.h"
#include "unwind-prot.h"
#include "utils.h"
#include "octave-default-image.h"
#include "graphics-props.cc"

Go to the source code of this file.

Macros

#define CHECK_ARRAY_EQUAL(T, F, A)
 
#define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL)
 
#define FIX_LIMITS
 
#define GO_BODY(TYPE)
 

Functions

int calc_dimensions (const graphics_object &go)
 
ColumnVector cam2xform (const Array< double > &m)
 
template<typename T >
void convert_cdata_1 (bool is_scaled, bool is_real, double clim_0, double clim_1, const double *cmapv, const T *cv, octave_idx_type lda, octave_idx_type nc, double *av)
 
std::vector< octave_idx_typecoplanar_partition (const Matrix &vert, const Matrix &idx, octave_idx_type nc, octave_idx_type jj)
 
ColumnVector cross (const ColumnVector &v1, const ColumnVector &v2)
 
void cross_product (double x1, double y1, double z1, double x2, double y2, double z2, double &x, double &y, double &z)
 
double dot (const ColumnVector &v1, const ColumnVector &v2)
 
octave_value_list F__calc_dimensions__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__get__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__get_frame__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__get_position__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__get_system_fonts__ (const octave_value_list &args, int)
 
octave_value_list F__go_axes__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_delete__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_execute_callback__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_figure__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_figure_handles__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_handles__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_hggroup__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_image__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_light__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_line__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_patch__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_post_callback__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_scatter__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_surface__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_text__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uibuttongroup__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uicontextmenu__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uicontrol__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uimenu__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uipanel__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uipushtool__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uitable__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uitoggletool__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__go_uitoolbar__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__image_pixel_size__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__is_handle_visible__ (const octave_value_list &args, int)
 
octave_value_list F__show_figure__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__update_normals__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list F__zoom__ (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Faddlistener (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Faddproperty (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Favailable_graphics_toolkits (octave::interpreter &interp, const octave_value_list &, int)
 
octave_value_list Fdellistener (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Fdrawnow (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Fget (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Fishghandle (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Floaded_graphics_toolkits (octave::interpreter &interp, const octave_value_list &, int)
 
double force_in_range (double x, double lower, double upper)
 
octave_value_list Fregister_graphics_toolkit (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Freset (octave::interpreter &interp, const octave_value_list &args, int)
 
octave_value_list Fset (octave::interpreter &interp, const octave_value_list &args, int nargout)
 
octave_value_list Fwaitfor (octave::interpreter &interp, const octave_value_list &args, int)
 
graphics_handle gca ()
 
graphics_handle gcf ()
 
void get_children_limits (double &min_val, double &max_val, double &min_pos, double &max_neg, const Matrix &kids, char limit_type)
 
octave_value get_property_from_handle (double handle, const std::string &property, const std::string &fcn)
 
bool is_coplanar (const Matrix &cov)
 
base_graphics_objectmake_graphics_object_from_type (const caseless_str &type, const graphics_handle &h, const graphics_handle &p)
 
double norm (const ColumnVector &v)
 
void normalize (ColumnVector &v)
 
void scale (ColumnVector &v, double x, double y, double z)
 
void scale (Matrix &m, double x, double y, double z)
 
bool set_property_in_handle (double handle, const std::string &property, const octave_value &arg, const std::string &fcn)
 
ColumnVector transform (const Matrix &m, double x, double y, double z)
 
void translate (ColumnVector &v, double x, double y, double z)
 
void translate (Matrix &m, double x, double y, double z)
 
Matrix unit_cube ()
 
void xform (ColumnVector &v, const Matrix &m)
 
RowVector xform2cam (const ColumnVector &v)
 
Matrix xform_matrix ()
 
Matrix xform_scale (double x, double y, double z)
 
Matrix xform_translate (double x, double y, double z)
 
ColumnVector xform_vector ()
 
ColumnVector xform_vector (double x, double y, double z)
 

Macro Definition Documentation

◆ CHECK_ARRAY_EQUAL

#define CHECK_ARRAY_EQUAL (   T,
  F,
  A 
)
Value:
{ \
if (m_data.numel () == 1) \
return m_data.F ## scalar_value () == \
v.F ## scalar_value (); \
else \
{ \
/* Keep copy of array_value to allow */ \
/* sparse/bool arrays that are converted, to */ \
/* not be deallocated early */ \
const A m1 = m_data.F ## array_value (); \
const T *d1 = m1.data (); \
const A m2 = v.F ## array_value (); \
const T *d2 = m2.data (); \
\
bool flag = true; \
for (int i = 0; flag && i < m_data.numel (); i++) \
if (d1[i] != d2[i]) \
flag = false; \
\
return flag; \
} \
}
F77_RET_T const F77_INT F77_CMPLX * A
for(octave_idx_type i=0;i< n;i++) ac+
Definition: mx-inlines.cc:764

◆ CONVERT_CDATA_1

#define CONVERT_CDATA_1 (   ARRAY_T,
  VAL_FN,
  IS_REAL 
)
Value:
do \
{ \
ARRAY_T tmp = cdata. VAL_FN ## array_value (); \
convert_cdata_1 (is_scaled, IS_REAL, clim_0, clim_1, cmapv, \
tmp.data (), lda, nc, av); \
} \
while (0)
void convert_cdata_1(bool is_scaled, bool is_real, double clim_0, double clim_1, const double *cmapv, const T *cv, octave_idx_type lda, octave_idx_type nc, double *av)
Definition: graphics.cc:984

◆ FIX_LIMITS

#define FIX_LIMITS
Value:
val = limits(0); \
min_val = val; \
val = limits(1); \
max_val = val;
bool isfinite(double x)
Definition: lo-mappers.h:192

◆ GO_BODY

#define GO_BODY (   TYPE)
Value:
gh_manager& gh_mgr = interp.get_gh_manager (); \
\
octave::autolock guard (gh_mgr.graphics_lock ()); \
\
if (args.length () == 0) \
print_usage (); \
\
return octave_value (make_graphics_object (#TYPE, false, args)); \
octave::mutex graphics_lock()
Definition: gh-manager.h:207
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))

Definition at line 12730 of file graphics.cc.

Function Documentation

◆ calc_dimensions()

◆ cam2xform()

ColumnVector cam2xform ( const Array< double > &  m)
inline

Definition at line 5586 of file graphics.cc.

References Array< T, Alloc >::fortran_vec(), and m.

Referenced by axes::properties::update_camera().

◆ convert_cdata_1()

template<typename T >
void convert_cdata_1 ( bool  is_scaled,
bool  is_real,
double  clim_0,
double  clim_1,
const double *  cmapv,
const T *  cv,
octave_idx_type  lda,
octave_idx_type  nc,
double *  av 
)

Definition at line 984 of file graphics.cc.

◆ coplanar_partition()

std::vector<octave_idx_type> coplanar_partition ( const Matrix vert,
const Matrix idx,
octave_idx_type  nc,
octave_idx_type  jj 
)

Definition at line 9539 of file graphics.cc.

References is_coplanar(), Matrix::resize(), and Matrix::transpose().

◆ cross()

ColumnVector cross ( const ColumnVector v1,
const ColumnVector v2 
)
inline

Definition at line 5553 of file graphics.cc.

References r, v2, and xform_vector().

◆ cross_product()

void cross_product ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double &  x,
double &  y,
double &  z 
)
inline

Definition at line 9776 of file graphics.cc.

References x.

◆ dot()

double dot ( const ColumnVector v1,
const ColumnVector v2 
)
inline

Definition at line 5541 of file graphics.cc.

References v2.

Referenced by norm().

◆ F__calc_dimensions__()

octave_value_list F__calc_dimensions__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ F__get__()

octave_value_list F__get__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ F__get_frame__()

octave_value_list F__get_frame__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ F__get_position__()

◆ F__get_system_fonts__()

octave_value_list F__get_system_fonts__ ( const octave_value_list args,
int   
)

Definition at line 14101 of file graphics.cc.

References octave_value_list::length(), ovl(), and print_usage().

◆ F__go_axes__()

octave_value_list F__go_axes__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12800 of file graphics.cc.

References GO_BODY.

◆ F__go_delete__()

◆ F__go_execute_callback__()

octave_value_list F__go_execute_callback__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ F__go_figure__()

◆ F__go_figure_handles__()

octave_value_list F__go_figure_handles__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ F__go_handles__()

octave_value_list F__go_handles__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ F__go_hggroup__()

octave_value_list F__go_hggroup__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12872 of file graphics.cc.

References GO_BODY.

◆ F__go_image__()

octave_value_list F__go_image__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12827 of file graphics.cc.

References GO_BODY.

◆ F__go_light__()

octave_value_list F__go_light__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12863 of file graphics.cc.

References GO_BODY.

◆ F__go_line__()

octave_value_list F__go_line__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12809 of file graphics.cc.

References GO_BODY.

◆ F__go_patch__()

octave_value_list F__go_patch__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12845 of file graphics.cc.

References GO_BODY.

◆ F__go_post_callback__()

octave_value_list F__go_post_callback__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ F__go_scatter__()

octave_value_list F__go_scatter__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12854 of file graphics.cc.

References GO_BODY.

◆ F__go_surface__()

octave_value_list F__go_surface__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12836 of file graphics.cc.

References GO_BODY.

◆ F__go_text__()

octave_value_list F__go_text__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12818 of file graphics.cc.

References GO_BODY.

◆ F__go_uibuttongroup__()

octave_value_list F__go_uibuttongroup__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12899 of file graphics.cc.

References GO_BODY.

◆ F__go_uicontextmenu__()

octave_value_list F__go_uicontextmenu__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12917 of file graphics.cc.

References GO_BODY.

◆ F__go_uicontrol__()

octave_value_list F__go_uicontrol__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12890 of file graphics.cc.

References GO_BODY.

◆ F__go_uimenu__()

octave_value_list F__go_uimenu__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12881 of file graphics.cc.

References GO_BODY.

◆ F__go_uipanel__()

octave_value_list F__go_uipanel__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12908 of file graphics.cc.

References GO_BODY.

◆ F__go_uipushtool__()

octave_value_list F__go_uipushtool__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12944 of file graphics.cc.

References GO_BODY.

◆ F__go_uitable__()

octave_value_list F__go_uitable__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12926 of file graphics.cc.

References GO_BODY.

◆ F__go_uitoggletool__()

octave_value_list F__go_uitoggletool__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12953 of file graphics.cc.

References GO_BODY.

◆ F__go_uitoolbar__()

octave_value_list F__go_uitoolbar__ ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 12935 of file graphics.cc.

References GO_BODY.

◆ F__image_pixel_size__()

◆ F__is_handle_visible__()

octave_value_list F__is_handle_visible__ ( const octave_value_list args,
int   
)

Definition at line 11947 of file graphics.cc.

References ovl(), and print_usage().

◆ F__show_figure__()

◆ F__update_normals__()

◆ F__zoom__()

◆ Faddlistener()

◆ Faddproperty()

◆ Favailable_graphics_toolkits()

octave_value_list Favailable_graphics_toolkits ( octave::interpreter &  interp,
const octave_value_list ,
int   
)

Definition at line 13130 of file graphics.cc.

References gh_manager::graphics_lock(), and ovl().

◆ Fdellistener()

◆ Fdrawnow()

◆ Fget()

octave_value_list Fget ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ Fishghandle()

octave_value_list Fishghandle ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 11874 of file graphics.cc.

References gh_manager::graphics_lock(), ovl(), and print_usage().

◆ Floaded_graphics_toolkits()

octave_value_list Floaded_graphics_toolkits ( octave::interpreter &  interp,
const octave_value_list ,
int   
)

Definition at line 13172 of file graphics.cc.

References gh_manager::graphics_lock(), and ovl().

◆ force_in_range()

double force_in_range ( double  x,
double  lower,
double  upper 
)
inline

Definition at line 8624 of file graphics.cc.

References x.

◆ Fregister_graphics_toolkit()

octave_value_list Fregister_graphics_toolkit ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ Freset()

octave_value_list Freset ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

◆ Fset()

◆ Fwaitfor()

octave_value_list Fwaitfor ( octave::interpreter &  interp,
const octave_value_list args,
int   
)

Definition at line 13768 of file graphics.cc.

References octave_value_list::length(), ovl(), and print_usage().

◆ gca()

graphics_handle gca ( )

Definition at line 2803 of file graphics.cc.

References octave_value::double_value(), gcf(), octave_value::isempty(), NaN, and xget().

◆ gcf()

graphics_handle gcf ( )

Definition at line 2793 of file graphics.cc.

References octave_value::double_value(), octave_value::isempty(), NaN, and xget().

Referenced by Fdrawnow(), and gca().

◆ get_children_limits()

void get_children_limits ( double &  min_val,
double &  max_val,
double &  min_pos,
double &  max_neg,
const Matrix kids,
char  limit_type 
)

◆ get_property_from_handle()

octave_value get_property_from_handle ( double  handle,
const std::string &  property,
const std::string &  fcn 
)

◆ is_coplanar()

bool is_coplanar ( const Matrix cov)

Definition at line 9527 of file graphics.cc.

References EIG::eigenvalues(), ColumnVector::max(), ColumnVector::min(), and real().

Referenced by coplanar_partition().

◆ make_graphics_object_from_type()

base_graphics_object* make_graphics_object_from_type ( const caseless_str type,
const graphics_handle h,
const graphics_handle p 
)

Definition at line 1205 of file graphics.cc.

References caseless_str::compare().

Referenced by gh_manager::make_graphics_handle().

◆ norm()

double norm ( const ColumnVector v)
inline

◆ normalize()

void normalize ( ColumnVector v)
inline

Definition at line 5534 of file graphics.cc.

References scale().

Referenced by axes::properties::update_camera().

◆ scale() [1/2]

void scale ( ColumnVector v,
double  x,
double  y,
double  z 
)
inline

Definition at line 5518 of file graphics.cc.

References x.

◆ scale() [2/2]

void scale ( Matrix m,
double  x,
double  y,
double  z 
)
inline

◆ set_property_in_handle()

bool set_property_in_handle ( double  handle,
const std::string &  property,
const octave_value arg,
const std::string &  fcn 
)

◆ transform()

◆ translate() [1/2]

void translate ( ColumnVector v,
double  x,
double  y,
double  z 
)
inline

Definition at line 5526 of file graphics.cc.

References x.

◆ translate() [2/2]

void translate ( Matrix m,
double  x,
double  y,
double  z 
)
inline

Definition at line 5506 of file graphics.cc.

References m, x, and xform_translate().

Referenced by axes::properties::update_camera().

◆ unit_cube()

Matrix unit_cube ( )
inline

Definition at line 5565 of file graphics.cc.

References m.

◆ xform()

void xform ( ColumnVector v,
const Matrix m 
)
inline

Definition at line 5512 of file graphics.cc.

References m.

Referenced by axes::properties::get_extent(), and axes::properties::update_camera().

◆ xform2cam()

RowVector xform2cam ( const ColumnVector v)
inline

Definition at line 5596 of file graphics.cc.

References ColumnVector::extract_n(), and ColumnVector::transpose().

Referenced by axes::properties::update_camera().

◆ xform_matrix()

Matrix xform_matrix ( )
inline

Definition at line 5435 of file graphics.cc.

References m.

Referenced by axes::properties::update_camera(), graphics_xform::xform_eye(), and xform_translate().

◆ xform_scale()

Matrix xform_scale ( double  x,
double  y,
double  z 
)
inline

Definition at line 5474 of file graphics.cc.

References m, and x.

Referenced by scale().

◆ xform_translate()

Matrix xform_translate ( double  x,
double  y,
double  z 
)
inline

Definition at line 5487 of file graphics.cc.

References m, x, and xform_matrix().

Referenced by translate().

◆ xform_vector() [1/2]

ColumnVector xform_vector ( )
inline

◆ xform_vector() [2/2]

ColumnVector xform_vector ( double  x,
double  y,
double  z 
)
inline

Definition at line 5456 of file graphics.cc.

References x.