mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-06 05:55:06 +00:00
Rename result_t to rebase_tent_result_t
This commit is contained in:
parent
847ead3588
commit
ca6425704d
4 changed files with 60 additions and 58 deletions
|
@ -444,7 +444,7 @@ struct tuple_delta_t
|
|||
|
||||
/* indices_length = point_count, indice[i] = 1 means point i is referenced */
|
||||
hb_vector_t<bool> indices;
|
||||
|
||||
|
||||
hb_vector_t<double> deltas_x;
|
||||
/* empty for cvar tuples */
|
||||
hb_vector_t<double> deltas_y;
|
||||
|
@ -556,7 +556,7 @@ struct tuple_delta_t
|
|||
return out;
|
||||
}
|
||||
|
||||
result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances);
|
||||
rebase_tent_result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances);
|
||||
for (auto &t : solutions)
|
||||
{
|
||||
tuple_delta_t new_var = *this;
|
||||
|
@ -1367,15 +1367,15 @@ struct TupleVariationData
|
|||
/* NULL offset, to keep original varidx valid, just return */
|
||||
if (&var_data == &Null (VarData))
|
||||
return true;
|
||||
|
||||
|
||||
unsigned num_regions = var_data.get_region_index_count ();
|
||||
if (!tuple_vars.alloc (num_regions)) return false;
|
||||
|
||||
|
||||
item_count = inner_map ? inner_map->get_population () : var_data.get_item_count ();
|
||||
if (!item_count) return true;
|
||||
unsigned row_size = var_data.get_row_size ();
|
||||
const HBUINT8 *delta_bytes = var_data.get_delta_bytes ();
|
||||
|
||||
|
||||
for (unsigned r = 0; r < num_regions; r++)
|
||||
{
|
||||
/* In VarData, deltas are organized in rows, convert them into
|
||||
|
@ -1384,14 +1384,14 @@ struct TupleVariationData
|
|||
if (!tuple.deltas_x.resize (item_count, false) ||
|
||||
!tuple.indices.resize (item_count, false))
|
||||
return false;
|
||||
|
||||
|
||||
for (unsigned i = 0; i < item_count; i++)
|
||||
{
|
||||
tuple.indices.arrayZ[i] = true;
|
||||
tuple.deltas_x.arrayZ[i] = var_data.get_item_delta_fast (inner_map ? inner_map->backward (i) : i,
|
||||
r, delta_bytes, row_size);
|
||||
}
|
||||
|
||||
|
||||
unsigned region_index = var_data.get_region_index (r);
|
||||
if (region_index >= regions.length) return false;
|
||||
tuple.axis_tuples = regions.arrayZ[region_index];
|
||||
|
@ -1503,11 +1503,11 @@ struct TupleVariationData
|
|||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
hb_vector_t<char> compiled_point_data;
|
||||
if (!tuple_delta_t::compile_point_set (*points_set, compiled_point_data))
|
||||
return false;
|
||||
|
||||
|
||||
if (!point_data_map.set (points_set, std::move (compiled_point_data)) ||
|
||||
!point_set_count_map.set (points_set, 1))
|
||||
return false;
|
||||
|
@ -1547,7 +1547,7 @@ struct TupleVariationData
|
|||
for (tuple_delta_t& var : tuple_vars)
|
||||
if (!var.calc_inferred_deltas (contour_points))
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1874,7 +1874,7 @@ struct TupleVariationData
|
|||
|
||||
if (!tuple_variations.serialize_var_headers (c, total_header_len))
|
||||
return_trace (false);
|
||||
|
||||
|
||||
unsigned data_offset = min_size + total_header_len;
|
||||
if (!is_gvar) data_offset += 4;
|
||||
if (!c->check_assign (out->data, data_offset, HB_SERIALIZE_ERROR_INT_OVERFLOW)) return_trace (false);
|
||||
|
@ -2335,12 +2335,12 @@ struct item_variations_t
|
|||
/* just sanity check, this shouldn't happen */
|
||||
if (encoding.is_empty ())
|
||||
return false;
|
||||
|
||||
|
||||
unsigned num_rows = encoding.items.length;
|
||||
|
||||
|
||||
/* sort rows, make result deterministic */
|
||||
encoding.items.qsort (_cmp_row);
|
||||
|
||||
|
||||
/* compile old to new var_idxes mapping */
|
||||
for (unsigned minor = 0; minor < num_rows; minor++)
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ static inline double supportScalar (double coord, const Triple &tent)
|
|||
return (end - coord) / (end - peak);
|
||||
}
|
||||
|
||||
static inline result_t
|
||||
static inline rebase_tent_result_t
|
||||
_solve (Triple tent, Triple axisLimit, bool negative = false)
|
||||
{
|
||||
double axisMin = axisLimit.minimum;
|
||||
|
@ -75,7 +75,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
|
|||
// Mirror the problem such that axisDef <= peak
|
||||
if (axisDef > peak)
|
||||
{
|
||||
result_t vec = _solve (_reverse_negate (tent),
|
||||
rebase_tent_result_t vec = _solve (_reverse_negate (tent),
|
||||
_reverse_negate (axisLimit),
|
||||
!negative);
|
||||
|
||||
|
@ -98,7 +98,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
|
|||
* axisMin axisDef axisMax lower upper
|
||||
*/
|
||||
if (axisMax <= lower && axisMax < peak)
|
||||
return result_t{}; // No overlap
|
||||
return rebase_tent_result_t{}; // No overlap
|
||||
|
||||
/* case 2: Only the peak and outermost bound fall outside the new limit;
|
||||
* we keep the deltaset, update peak and outermost bound and scale deltas
|
||||
|
@ -133,7 +133,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
|
|||
double mult = supportScalar (axisMax, tent);
|
||||
tent = Triple{lower, axisMax, axisMax};
|
||||
|
||||
result_t vec = _solve (tent, axisLimit);
|
||||
rebase_tent_result_t vec = _solve (tent, axisLimit);
|
||||
|
||||
for (auto &p : vec)
|
||||
p = hb_pair (p.first * mult, p.second);
|
||||
|
@ -144,7 +144,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
|
|||
// lower <= axisDef <= peak <= axisMax
|
||||
|
||||
double gain = supportScalar (axisDef, tent);
|
||||
result_t out {hb_pair (gain, Triple{})};
|
||||
rebase_tent_result_t out {hb_pair (gain, Triple{})};
|
||||
|
||||
// First, the positive side
|
||||
|
||||
|
@ -258,7 +258,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
|
|||
assert (axisMax <= newUpper); // Because outGain > gain
|
||||
/* Disabled because ots doesn't like us:
|
||||
* https://github.com/fonttools/fonttools/issues/3350 */
|
||||
|
||||
|
||||
if (false && (newUpper <= axisDef + (axisMax - axisDef) * 2))
|
||||
{
|
||||
upper = newUpper;
|
||||
|
@ -405,18 +405,18 @@ double renormalizeValue (double v, const Triple &triple,
|
|||
return (-v_distance) /total_distance;
|
||||
}
|
||||
|
||||
result_t
|
||||
rebase_tent_result_t
|
||||
rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances)
|
||||
{
|
||||
assert (-1.0 <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.0);
|
||||
assert (-2.0 <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.0);
|
||||
assert (tent.middle != 0.0);
|
||||
|
||||
result_t sols = _solve (tent, axisLimit);
|
||||
rebase_tent_result_t sols = _solve (tent, axisLimit);
|
||||
|
||||
auto n = [&axisLimit, &axis_triple_distances] (double v) { return renormalizeValue (v, axisLimit, axis_triple_distances); };
|
||||
|
||||
result_t out;
|
||||
rebase_tent_result_t out;
|
||||
for (auto &p : sols)
|
||||
{
|
||||
if (!p.first) continue;
|
||||
|
|
|
@ -87,8 +87,8 @@ struct Triple {
|
|||
double maximum;
|
||||
};
|
||||
|
||||
using result_item_t = hb_pair_t<double, Triple>;
|
||||
using result_t = hb_vector_t<result_item_t>;
|
||||
using rebase_tent_result_item_t = hb_pair_t<double, Triple>;
|
||||
using rebase_tent_result_t = hb_vector_t<rebase_tent_result_item_t>;
|
||||
|
||||
/* renormalize a normalized value v to the range of an axis,
|
||||
* considering the prenormalized distances as well as the new axis limits.
|
||||
|
@ -107,6 +107,8 @@ HB_INTERNAL double renormalizeValue (double v, const Triple &triple,
|
|||
* If tent value is Triple{}, that is a special deltaset that should
|
||||
* be always-enabled (called "gain").
|
||||
*/
|
||||
HB_INTERNAL result_t rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances);
|
||||
HB_INTERNAL rebase_tent_result_t rebase_tent (Triple tent,
|
||||
Triple axisLimit,
|
||||
TripleDistances axis_triple_distances);
|
||||
|
||||
#endif /* HB_SUBSET_INSTANCER_SOLVER_HH */
|
||||
|
|
|
@ -48,7 +48,7 @@ main (int argc, char **argv)
|
|||
/* pin axis*/
|
||||
Triple tent (0.0, 1.0, 1.0);
|
||||
Triple axis_range (0.0, 0.0, 0.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 0);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ main (int argc, char **argv)
|
|||
/* pin axis*/
|
||||
Triple tent (0.0, 1.0, 1.0);
|
||||
Triple axis_range (0.5, 0.5, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 0.5);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -66,7 +66,7 @@ main (int argc, char **argv)
|
|||
/* tent falls outside the new axis range */
|
||||
Triple tent (0.3, 0.5, 0.8);
|
||||
Triple axis_range (0.1, 0.2, 0.3);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 0);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 1.0, 1.0);
|
||||
Triple axis_range (-1.0, 0.0, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 0.5);
|
||||
assert (out[0].second == Triple (0.0, 1.0, 1.0));
|
||||
|
@ -84,7 +84,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 1.0, 1.0);
|
||||
Triple axis_range (-1.0, 0.0, 0.75);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 0.75);
|
||||
assert (out[0].second == Triple (0.0, 1.0, 1.0));
|
||||
|
@ -95,7 +95,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.2, 1.0);
|
||||
Triple axis_range (-1.0, 0.0, 0.8);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (0.0, 0.25, 1.0));
|
||||
|
@ -107,7 +107,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.4, 1.0);
|
||||
Triple axis_range (-1.0, 0.0, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (0.0, 0.8, 1.0));
|
||||
|
@ -119,7 +119,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.25, 1.0);
|
||||
Triple axis_range (-1.0, 0.0, 0.4);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (0.0, 0.625, 1.0));
|
||||
|
@ -131,7 +131,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.25, 0.3, 1.05);
|
||||
Triple axis_range (0.0, 0.2, 0.4);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (approx (out[0].second, Triple (0.25, 0.5, 1.0)));
|
||||
|
@ -143,7 +143,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.25, 0.5, 1.0);
|
||||
Triple axis_range (0.0, 0.25, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (0.0, 1.0, 1.0));
|
||||
|
@ -154,7 +154,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.5, 1.0);
|
||||
Triple axis_range (0.0, 0.5, 1.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 3);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -167,7 +167,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.5, 1.0);
|
||||
Triple axis_range (0.0, 0.5, 0.75);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 3);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -180,7 +180,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.50, 1.0);
|
||||
Triple axis_range (0.0, 0.25, 0.8);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 4);
|
||||
assert (out[0].first == 0.5);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -196,7 +196,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.5, 2.0);
|
||||
Triple axis_range (0.2, 0.5, 0.8);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 3);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -210,7 +210,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.5, 2.0);
|
||||
Triple axis_range (0.2, 0.5, 1.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 3);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -224,7 +224,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.5, 1.0);
|
||||
Triple axis_range (0.25, 0.25, 0.75);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 0.5);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -236,7 +236,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.5, 1.0);
|
||||
Triple axis_range (0.0, 0.25, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 3);
|
||||
assert (out[0].first == 0.5);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -250,7 +250,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.05, 0.55, 1.0);
|
||||
Triple axis_range (0.0, 0.25, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 4);
|
||||
assert (approx (out[0].first, 0.4));
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -266,7 +266,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (-1.0, -0.55, -0.05);
|
||||
Triple axis_range (-0.5, -0.25, 0.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 4);
|
||||
assert (approx (out[0].first, 0.4));
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -282,7 +282,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.5, 0.5, 0.5);
|
||||
Triple axis_range (0.5, 0.5, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -291,7 +291,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.3, 0.5, 0.7);
|
||||
Triple axis_range (0.1, 0.5, 0.9);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 5);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -308,7 +308,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.5, 0.5, 0.5);
|
||||
Triple axis_range (0.25, 0.25, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (1.0, 1.0, 1.0));
|
||||
|
@ -317,7 +317,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.5, 0.5, 0.5);
|
||||
Triple axis_range (0.25, 0.35, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (1.0, 1.0, 1.0));
|
||||
|
@ -326,7 +326,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.5, 0.5, 0.55);
|
||||
Triple axis_range (0.25, 0.35, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (1.0, 1.0, 1.0));
|
||||
|
@ -335,7 +335,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.5, 0.5, 1.0);
|
||||
Triple axis_range (0.5, 0.5, 1.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -346,7 +346,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.25, 0.5, 1.0);
|
||||
Triple axis_range (0.5, 0.5, 1.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -357,7 +357,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.2, 1.0);
|
||||
Triple axis_range (0.0, 0.0, 0.5);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 2);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (0.0, 0.4, 1.0));
|
||||
|
@ -369,7 +369,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 0.5, 1.0);
|
||||
Triple axis_range (-1.0, 0.25, 1.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 5);
|
||||
assert (out[0].first == 0.5);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -386,7 +386,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.5, 0.5, 0.5);
|
||||
Triple axis_range (0.0, 0.5, 1.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 5);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple ());
|
||||
|
@ -403,7 +403,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
Triple tent (0.0, 1.0, 1.0);
|
||||
Triple axis_range (-1.0, -0.5, 1.0);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (1.0/3, 1.0, 1.0));
|
||||
|
@ -413,7 +413,7 @@ main (int argc, char **argv)
|
|||
Triple tent (0.0, 1.0, 1.0);
|
||||
Triple axis_range (-1.0, -0.5, 1.0);
|
||||
TripleDistances axis_distances{2.0, 1.0};
|
||||
result_t out = rebase_tent (tent, axis_range, axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (out[0].second == Triple (0.5, 1.0, 1.0));
|
||||
|
@ -423,7 +423,7 @@ main (int argc, char **argv)
|
|||
Triple tent (0.6, 0.7, 0.8);
|
||||
Triple axis_range (-1.0, 0.2, 1.0);
|
||||
TripleDistances axis_distances{1.0, 1.0};
|
||||
result_t out = rebase_tent (tent, axis_range, axis_distances);
|
||||
rebase_tent_result_t out = rebase_tent (tent, axis_range, axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.0);
|
||||
assert (approx (out[0].second, Triple (0.5, 0.625, 0.75)));
|
||||
|
|
Loading…
Add table
Reference in a new issue