MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_set_axes_limits_compute

Function af_set_axes_limits_compute

src/api/c/window.cpp:70–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70af_err af_set_axes_limits_compute(const af_window window, const af_array x,
71 const af_array y, const af_array z,
72 const bool exact,
73 const af_cell* const props) {
74 try {
75 if (window == 0) { AF_ERROR("Not a valid window", AF_ERR_INTERNAL); }
76
77 ForgeManager& fgMngr = forgeManager();
78
79 fg_chart chart = nullptr;
80
81 fg_chart_type ctype = (z ? FG_CHART_3D : FG_CHART_2D);
82
83 if (props->col > -1 && props->row > -1) {
84 chart = fgMngr.getChart(window, props->row, props->col, ctype);
85 } else {
86 chart = fgMngr.getChart(window, 0, 0, ctype);
87 }
88
89 double xmin = -1., xmax = 1.;
90 double ymin = -1., ymax = 1.;
91 double zmin = -1., zmax = 1.;
92 AF_CHECK(af_min_all(&xmin, nullptr, x));
93 AF_CHECK(af_max_all(&xmax, nullptr, x));
94 AF_CHECK(af_min_all(&ymin, nullptr, y));
95 AF_CHECK(af_max_all(&ymax, nullptr, y));
96
97 if (ctype == FG_CHART_3D) {
98 AF_CHECK(af_min_all(&zmin, nullptr, z));
99 AF_CHECK(af_max_all(&zmax, nullptr, z));
100 }
101
102 if (!exact) {
103 xmin = step_round(xmin, false);
104 xmax = step_round(xmax, true);
105 ymin = step_round(ymin, false);
106 ymax = step_round(ymax, true);
107 zmin = step_round(zmin, false);
108 zmax = step_round(zmax, true);
109 }
110
111 fgMngr.setChartAxesOverride(chart);
112 FG_CHECK(forgePlugin().fg_set_chart_axes_limits(chart, xmin, xmax, ymin,
113 ymax, zmin, zmax));
114 }
115 CATCHALL;
116 return AF_SUCCESS;
117}
118
119af_err af_set_axes_limits_2d(const af_window window, const float xmin,
120 const float xmax, const float ymin,

Callers 1

setAxesLimitsMethod · 0.50

Calls 5

af_min_allFunction · 0.85
af_max_allFunction · 0.85
step_roundFunction · 0.85
getChartMethod · 0.80
setChartAxesOverrideMethod · 0.80

Tested by

no test coverage detected