mirror of https://github.com/KLayout/klayout.git
Some bug fixes, updated tests
This commit is contained in:
parent
08666aeb82
commit
c6e7c47d6c
|
|
@ -424,7 +424,7 @@ AsIfFlatRegion::filtered_pair (const PolygonFilterBase &filter) const
|
|||
if (filter.selected (*p)) {
|
||||
new_region_true->insert (*p);
|
||||
} else {
|
||||
new_region_true->insert (*p);
|
||||
new_region_false->insert (*p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -469,9 +469,9 @@ static db::EdgePairs with_length1 (const db::EdgePairs *r, db::EdgePairs::distan
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_length1 (const db::EdgePairs *r, db::EdgePairs::distance_type length)
|
||||
static std::vector<db::EdgePairs> split_with_length1 (const db::EdgePairs *r, db::EdgePairs::distance_type length, bool inverse)
|
||||
{
|
||||
db::EdgeLengthFilter f (length, length + 1, false);
|
||||
db::EdgeLengthFilter f (length, length + 1, inverse);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, true /*one must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -483,9 +483,9 @@ static db::EdgePairs with_length2 (const db::EdgePairs *r, const tl::Variant &mi
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_length2 (const db::EdgePairs *r, const tl::Variant &min, const tl::Variant &max)
|
||||
static std::vector<db::EdgePairs> split_with_length2 (const db::EdgePairs *r, const tl::Variant &min, const tl::Variant &max, bool inverse)
|
||||
{
|
||||
db::EdgeLengthFilter f (min.is_nil () ? db::Edges::distance_type (0) : min.to<db::Edges::distance_type> (), max.is_nil () ? std::numeric_limits <db::Edges::distance_type>::max () : max.to<db::Edges::distance_type> (), false);
|
||||
db::EdgeLengthFilter f (min.is_nil () ? db::Edges::distance_type (0) : min.to<db::Edges::distance_type> (), max.is_nil () ? std::numeric_limits <db::Edges::distance_type>::max () : max.to<db::Edges::distance_type> (), inverse);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, true /*one must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -497,9 +497,9 @@ static db::EdgePairs with_length_both1 (const db::EdgePairs *r, db::EdgePairs::d
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_length_both1 (const db::EdgePairs *r, db::EdgePairs::distance_type length)
|
||||
static std::vector<db::EdgePairs> split_with_length_both1 (const db::EdgePairs *r, db::EdgePairs::distance_type length, bool inverse)
|
||||
{
|
||||
db::EdgeLengthFilter f (length, length + 1, false);
|
||||
db::EdgeLengthFilter f (length, length + 1, inverse);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, false /*both must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -511,9 +511,9 @@ static db::EdgePairs with_length_both2 (const db::EdgePairs *r, const tl::Varian
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_length_both2 (const db::EdgePairs *r, const tl::Variant &min, const tl::Variant &max)
|
||||
static std::vector<db::EdgePairs> split_with_length_both2 (const db::EdgePairs *r, const tl::Variant &min, const tl::Variant &max, bool inverse)
|
||||
{
|
||||
db::EdgeLengthFilter f (min.is_nil () ? db::Edges::distance_type (0) : min.to<db::Edges::distance_type> (), max.is_nil () ? std::numeric_limits <db::Edges::distance_type>::max () : max.to<db::Edges::distance_type> (), false);
|
||||
db::EdgeLengthFilter f (min.is_nil () ? db::Edges::distance_type (0) : min.to<db::Edges::distance_type> (), max.is_nil () ? std::numeric_limits <db::Edges::distance_type>::max () : max.to<db::Edges::distance_type> (), inverse);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, false /*both must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -525,9 +525,9 @@ static db::EdgePairs with_angle1 (const db::EdgePairs *r, double a, bool inverse
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_angle1 (const db::EdgePairs *r, double a)
|
||||
static std::vector<db::EdgePairs> split_with_angle1 (const db::EdgePairs *r, double a, bool inverse)
|
||||
{
|
||||
db::EdgeOrientationFilter f (a, false, false);
|
||||
db::EdgeOrientationFilter f (a, inverse, false);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, true /*one must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -539,9 +539,9 @@ static db::EdgePairs with_angle2 (const db::EdgePairs *r, double amin, double am
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_angle2 (const db::EdgePairs *r, double amin, double amax, bool include_amin, bool include_amax)
|
||||
static std::vector<db::EdgePairs> split_with_angle2 (const db::EdgePairs *r, double amin, double amax, bool inverse, bool include_amin, bool include_amax)
|
||||
{
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, false, false);
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, inverse, false);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, true /*one must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -553,9 +553,9 @@ static db::EdgePairs with_abs_angle1 (const db::EdgePairs *r, double a, bool inv
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle1 (const db::EdgePairs *r, double a)
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle1 (const db::EdgePairs *r, double a, bool inverse)
|
||||
{
|
||||
db::EdgeOrientationFilter f (a, false, true);
|
||||
db::EdgeOrientationFilter f (a, inverse, true);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, true /*one must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -567,9 +567,9 @@ static db::EdgePairs with_abs_angle2 (const db::EdgePairs *r, double amin, doubl
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle2 (const db::EdgePairs *r, double amin, double amax, bool include_amin, bool include_amax)
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle2 (const db::EdgePairs *r, double amin, double amax, bool inverse, bool include_amin, bool include_amax)
|
||||
{
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, false, true);
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, inverse, true);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, true /*one must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -581,9 +581,9 @@ static db::EdgePairs with_angle3 (const db::EdgePairs *r, db::SpecialEdgeOrienta
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_angle3 (const db::EdgePairs *r, db::SpecialEdgeOrientationFilter::FilterType type)
|
||||
static std::vector<db::EdgePairs> split_with_angle3 (const db::EdgePairs *r, db::SpecialEdgeOrientationFilter::FilterType type, bool inverse)
|
||||
{
|
||||
db::SpecialEdgeOrientationFilter f (type, false);
|
||||
db::SpecialEdgeOrientationFilter f (type, inverse);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, true /*one must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -595,9 +595,9 @@ static db::EdgePairs with_angle_both1 (const db::EdgePairs *r, double a, bool in
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_angle_both1 (const db::EdgePairs *r, double a)
|
||||
static std::vector<db::EdgePairs> split_with_angle_both1 (const db::EdgePairs *r, double a, bool inverse)
|
||||
{
|
||||
db::EdgeOrientationFilter f (a, false, false);
|
||||
db::EdgeOrientationFilter f (a, inverse, false);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, false /*both must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -609,9 +609,9 @@ static db::EdgePairs with_angle_both2 (const db::EdgePairs *r, double amin, doub
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_angle_both2 (const db::EdgePairs *r, double amin, double amax, bool include_amin, bool include_amax)
|
||||
static std::vector<db::EdgePairs> split_with_angle_both2 (const db::EdgePairs *r, double amin, double amax, bool inverse, bool include_amin, bool include_amax)
|
||||
{
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, false, false);
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, inverse, false);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, false /*both must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -623,9 +623,9 @@ static db::EdgePairs with_abs_angle_both1 (const db::EdgePairs *r, double a, boo
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle_both1 (const db::EdgePairs *r, double a)
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle_both1 (const db::EdgePairs *r, double a, bool inverse)
|
||||
{
|
||||
db::EdgeOrientationFilter f (a, false, true);
|
||||
db::EdgeOrientationFilter f (a, inverse, true);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, false /*both must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -637,9 +637,9 @@ static db::EdgePairs with_abs_angle_both2 (const db::EdgePairs *r, double amin,
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle_both2 (const db::EdgePairs *r, double amin, double amax, bool include_amin, bool include_amax)
|
||||
static std::vector<db::EdgePairs> split_with_abs_angle_both2 (const db::EdgePairs *r, double amin, double amax, bool inverse, bool include_amin, bool include_amax)
|
||||
{
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, false, true);
|
||||
db::EdgeOrientationFilter f (amin, include_amin, amax, include_amax, inverse, true);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, false /*both must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -651,9 +651,9 @@ static db::EdgePairs with_angle_both3 (const db::EdgePairs *r, db::SpecialEdgeOr
|
|||
return r->filtered (ef);
|
||||
}
|
||||
|
||||
static std::vector<db::EdgePairs> split_with_angle_both3 (const db::EdgePairs *r, db::SpecialEdgeOrientationFilter::FilterType type)
|
||||
static std::vector<db::EdgePairs> split_with_angle_both3 (const db::EdgePairs *r, db::SpecialEdgeOrientationFilter::FilterType type, bool inverse)
|
||||
{
|
||||
db::SpecialEdgeOrientationFilter f (type, false);
|
||||
db::SpecialEdgeOrientationFilter f (type, inverse);
|
||||
db::EdgeFilterBasedEdgePairFilter ef (&f, false /*both must match*/);
|
||||
return as_2edge_pairs_vector (r->split_filter (ef));
|
||||
}
|
||||
|
|
@ -1104,15 +1104,17 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
|
|||
"\n"
|
||||
"This method has been added in version 0.27.1.\n"
|
||||
) +
|
||||
method_ext ("split_with_length", split_with_length1, gsi::arg ("length"),
|
||||
method_ext ("split_with_length", split_with_length1, gsi::arg ("length"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_length, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_length", split_with_length2, gsi::arg ("min_length"), gsi::arg ("max_length"),
|
||||
method_ext ("split_with_length", split_with_length2, gsi::arg ("min_length"), gsi::arg ("max_length"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_length, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
|
|
@ -1134,15 +1136,17 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
|
|||
"\n"
|
||||
"This method has been added in version 0.27.1.\n"
|
||||
) +
|
||||
method_ext ("split_with_length_both", split_with_length_both1, gsi::arg ("length"),
|
||||
method_ext ("split_with_length_both", split_with_length_both1, gsi::arg ("length"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_length_both, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_length_both", split_with_length_both2, gsi::arg ("min_length"), gsi::arg ("max_length"),
|
||||
method_ext ("split_with_length_both", split_with_length_both2, gsi::arg ("min_length"), gsi::arg ("max_length"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_length_both, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
|
|
@ -1238,21 +1242,24 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
|
|||
"\n"
|
||||
"This method has been added in version 0.28.\n"
|
||||
) +
|
||||
method_ext ("split_with_angle", split_with_angle1, gsi::arg ("angle"),
|
||||
method_ext ("split_with_angle", split_with_angle1, gsi::arg ("angle"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_angle, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_angle", split_with_angle2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
method_ext ("split_with_angle", split_with_angle2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("inverse"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
"@brief Like \\with_angle, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_angle", split_with_angle3, gsi::arg ("type"),
|
||||
method_ext ("split_with_angle", split_with_angle3, gsi::arg ("type"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_angle, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
|
|
@ -1272,15 +1279,17 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
|
|||
"\n"
|
||||
"This method has been added in version 0.29.1.\n"
|
||||
) +
|
||||
method_ext ("split_with_abs_angle", split_with_abs_angle1, gsi::arg ("angle"),
|
||||
method_ext ("split_with_abs_angle", split_with_abs_angle1, gsi::arg ("angle"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_abs_angle, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_abs_angle", split_with_abs_angle2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
method_ext ("split_with_abs_angle", split_with_abs_angle2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("inverse"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
"@brief Like \\with_abs_angle, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
|
|
@ -1344,21 +1353,24 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
|
|||
"\n"
|
||||
"This method has been added in version 0.28.\n"
|
||||
) +
|
||||
method_ext ("split_with_angle_both", split_with_angle_both1, gsi::arg ("angle"),
|
||||
method_ext ("split_with_angle_both", split_with_angle_both1, gsi::arg ("angle"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_angle_both, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_angle_both", split_with_angle_both2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
method_ext ("split_with_angle_both", split_with_angle_both2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("inverse"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
"@brief Like \\with_angle_both, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_angle_both", split_with_angle_both3, gsi::arg ("type"),
|
||||
method_ext ("split_with_angle_both", split_with_angle_both3, gsi::arg ("type"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_angle_both, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
|
|
@ -1377,15 +1389,17 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
|
|||
"\n"
|
||||
"This method has been added in version 0.29.1.\n"
|
||||
) +
|
||||
method_ext ("split_with_abs_angle_both", split_with_abs_angle_both1, gsi::arg ("angle"),
|
||||
method_ext ("split_with_abs_angle_both", split_with_abs_angle_both1, gsi::arg ("angle"), gsi::arg ("inverse"),
|
||||
"@brief Like \\with_abs_angle_both, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
method_ext ("split_with_abs_angle_both", split_with_abs_angle_both2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
method_ext ("split_with_abs_angle_both", split_with_abs_angle_both2, gsi::arg ("min_angle"), gsi::arg ("max_angle"), gsi::arg ("inverse"), gsi::arg ("include_min_angle", true), gsi::arg ("include_max_angle", false),
|
||||
"@brief Like \\with_abs_angle_both, but returning two edge pair collections\n"
|
||||
"The first edge pair collection will contain all matching shapes, the other the non-matching ones.\n"
|
||||
"Note that 'inverse' controls the way each edge is checked, not overall.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.12.\n"
|
||||
) +
|
||||
|
|
|
|||
|
|
@ -294,53 +294,90 @@ class DBEdgePairs_TestClass < TestBase
|
|||
ep4 = RBA::EdgePair::new(RBA::Edge::new(0, 0, 0, 10), RBA::Edge::new(10, 0, 10, 10))
|
||||
|
||||
r1 = RBA::EdgePairs::new([ ep1, ep2, ep3, ep4 ])
|
||||
assert_equal(r1.with_angle(0, 90, false).to_s, "") # @@@
|
||||
assert_equal(r1.with_angle(0, 90, false).to_s, "")
|
||||
|
||||
assert_equal(r1.with_distance(10, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_distance(10)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_distance(5, 20, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_distance(5, 20)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_distance(15, 20, false).to_s, "")
|
||||
assert_equal(r1.split_with_distance(15, 20)[0].to_s, "")
|
||||
assert_equal(r1.with_distance(15, 20, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_distance(15, 20)[1].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
|
||||
assert_equal(r1.with_length(10, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_length(10, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_length(10, 20, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_length(10, 20, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_length(10, 21, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_length(10, 21, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_length(10, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0)")
|
||||
assert_equal(r1.split_with_length(10, false)[1].to_s, "(0,0;0,20)/(10,20;10,0)")
|
||||
assert_equal(r1.with_length_both(10, false).to_s, "(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_length_both(10, false)[0].to_s, "(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_length_both(10, 20, false).to_s, "(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_length_both(10, 20, false)[0].to_s, "(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_length_both(10, 21, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_length_both(10, 21, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_length_both(10, true).to_s, "(0,0;0,20)/(10,20;10,0)")
|
||||
assert_equal(r1.split_with_length_both(10, false)[1].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0)")
|
||||
|
||||
assert_equal(r1.with_angle(0, false).to_s, "")
|
||||
assert_equal(r1.split_with_angle(0, false)[0].to_s, "")
|
||||
assert_equal(r1.with_abs_angle(0, false).to_s, "")
|
||||
assert_equal(r1.split_with_abs_angle(0, false)[0].to_s, "")
|
||||
assert_equal(r1.with_angle(0, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_angle(0, false)[1].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_abs_angle(0, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_abs_angle(0, false)[1].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_angle(90, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_angle(90, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_abs_angle(90, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_abs_angle(90, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_angle(0, 90, false).to_s, "")
|
||||
assert_equal(r1.split_with_angle(0, 90, false)[0].to_s, "")
|
||||
assert_equal(r1.with_abs_angle(0, 90, false).to_s, "")
|
||||
assert_equal(r1.split_with_abs_angle(0, 90, false)[0].to_s, "")
|
||||
assert_equal(r1.with_angle(0, 90, false, true, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_angle(0, 90, false, true, true)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_abs_angle(0, 90, false, true, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_abs_angle(0, 90, false, true, true)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_angle_both(0, false).to_s, "")
|
||||
assert_equal(r1.split_with_angle_both(0, false)[0].to_s, "")
|
||||
assert_equal(r1.with_abs_angle_both(0, false).to_s, "")
|
||||
assert_equal(r1.split_with_abs_angle_both(0, false)[0].to_s, "")
|
||||
assert_equal(r1.with_angle_both(0, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_angle_both(0, false)[1].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_abs_angle_both(0, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_abs_angle_both(0, false)[1].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_angle_both(90, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_angle_both(90, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_abs_angle_both(90, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_abs_angle_both(90, false)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_angle_both(0, 90, false).to_s, "")
|
||||
assert_equal(r1.with_abs_angle_both(0, 90, false).to_s, "")
|
||||
assert_equal(r1.with_angle_both(0, 90, false, true, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_abs_angle_both(0, 90, false, true, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
|
||||
assert_equal(r1.with_area(0, false).to_s, "(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_area(0)[0].to_s, "(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_area(150, false).to_s, "(0,0;0,10)/(10,20;10,0)")
|
||||
assert_equal(r1.split_with_area(150)[0].to_s, "(0,0;0,10)/(10,20;10,0)")
|
||||
assert_equal(r1.with_area(0, true).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0)")
|
||||
assert_equal(r1.split_with_area(0)[1].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0)")
|
||||
assert_equal(r1.with_area(150, 151, false).to_s, "(0,0;0,10)/(10,20;10,0)")
|
||||
assert_equal(r1.split_with_area(150, 151)[0].to_s, "(0,0;0,10)/(10,20;10,0)")
|
||||
assert_equal(r1.with_area(150, 150, false).to_s, "")
|
||||
assert_equal(r1.split_with_area(150, 150)[0].to_s, "")
|
||||
assert_equal(r1.with_area(150, 151, true).to_s, "(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_area(150, 151)[1].to_s, "(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
|
||||
assert_equal(r1.with_internal_angle(0, false).to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.split_with_internal_angle(0)[0].to_s, "(0,0;0,10)/(10,20;10,0);(0,0;0,10)/(10,0;10,20);(0,0;0,20)/(10,20;10,0);(0,0;0,10)/(10,0;10,10)")
|
||||
assert_equal(r1.with_internal_angle(0, 0, false).to_s, "")
|
||||
assert_equal(r1.split_with_internal_angle(0, 0)[0].to_s, "")
|
||||
assert_equal(r1.with_internal_angle(0, true).to_s, "")
|
||||
assert_equal(r1.split_with_internal_angle(0)[1].to_s, "")
|
||||
|
||||
ep1 = RBA::EdgePair::new(RBA::Edge::new(0, 0, 0, 10), RBA::Edge::new(10, 20, 10, 0))
|
||||
ep2 = RBA::EdgePair::new(RBA::Edge::new(0, 0, 0, 10), RBA::Edge::new(20, 0, 30, 0))
|
||||
|
|
@ -419,6 +456,8 @@ class DBEdgePairs_TestClass < TestBase
|
|||
edge_pairs.insert(RBA::EdgePair::new([200, 0, 300, 0], [200, 100, 220, 300 ]))
|
||||
|
||||
assert_equal(edge_pairs.filtered(f).to_s, "(0,0;100,0)/(0,100;0,300)")
|
||||
assert_equal(edge_pairs.split_filter(f)[0].to_s, "(0,0;100,0)/(0,100;0,300)")
|
||||
assert_equal(edge_pairs.split_filter(f)[1].to_s, "(200,0;300,0)/(200,100;220,300)")
|
||||
assert_equal(edge_pairs.to_s, "(0,0;100,0)/(0,100;0,300);(200,0;300,0)/(200,100;220,300)")
|
||||
edge_pairs.filter(f)
|
||||
assert_equal(edge_pairs.to_s, "(0,0;100,0)/(0,100;0,300)")
|
||||
|
|
|
|||
|
|
@ -585,25 +585,35 @@ class DBEdges_TestClass < TestBase
|
|||
r.insert(RBA::Edge::new(0, 0, 100, 0))
|
||||
r.insert(RBA::Edge::new(100, 0, 100, 50))
|
||||
assert_equal(r.with_angle(0, false).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.split_with_angle(0)[0].to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_abs_angle(0, false).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.split_with_abs_angle(0)[0].to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_angle(0, true).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.split_with_angle(0)[1].to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_abs_angle(0, true).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.split_with_abs_angle(0)[1].to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_angle(90, false).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_abs_angle(90, false).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_angle(90, true).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_abs_angle(90, true).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_angle(-10, 10, false).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.split_with_angle(-10, 10)[0].to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_abs_angle(-10, 10, false).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_angle(-10, 10, true).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.split_with_angle(-10, 10)[1].to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_abs_angle(-10, 10, true).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_angle(80, 100, false).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_abs_angle(80, 100, false).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_length(100, false).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.split_with_length(100)[0].to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_length(100, true).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.split_with_length(100)[1].to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_length(50, false).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_length(50, true).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_length(100, nil, false).to_s, "(0,0;100,0)")
|
||||
assert_equal(r.split_with_length(100, nil)[0].to_s, "(0,0;100,0)")
|
||||
assert_equal(r.with_length(100, 200, true).to_s, "(100,0;100,50)")
|
||||
assert_equal(r.split_with_length(100, 200)[1].to_s, "(100,0;100,50)")
|
||||
assert_equal(r.with_length(nil, 100, false).to_s, "(100,0;100,50)")
|
||||
|
||||
r = RBA::Edges::new
|
||||
|
|
@ -882,6 +892,8 @@ class DBEdges_TestClass < TestBase
|
|||
edges.insert(RBA::Edge::new(100, 100, 100, 200))
|
||||
|
||||
assert_equal(edges.filtered(f).to_s, "(100,0;200,100)")
|
||||
assert_equal(edges.split_filter(f)[0].to_s, "(100,0;200,100)")
|
||||
assert_equal(edges.split_filter(f)[1].to_s, "(100,100;100,200)")
|
||||
assert_equal(edges.to_s, "(100,0;200,100);(100,100;100,200)")
|
||||
edges.filter(f)
|
||||
assert_equal(edges.to_s, "(100,0;200,100)")
|
||||
|
|
|
|||
|
|
@ -485,46 +485,68 @@ class DBRegion_TestClass < TestBase
|
|||
r.merged_semantics = false
|
||||
|
||||
assert_equal(r.with_area(20000, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_area(20000)[0].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_area(20000, true).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_area(20000)[1].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(csort(r.with_area(10000, nil, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_area(10000, 20000, false).to_s, "")
|
||||
assert_equal(r.with_area(nil, 20001, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(csort(r.with_area(10000, 20000, true).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
|
||||
assert_equal(r.with_perimeter(600, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_perimeter(600)[0].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_perimeter(600, true).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_perimeter(600)[1].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(csort(r.with_perimeter(600, nil, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_perimeter(600, 1000, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_perimeter(nil, 1000, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_perimeter(nil, 1000)[0].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_perimeter(600, 1000, true).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_perimeter(600, 1000)[1].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
|
||||
assert_equal(r.with_bbox_height(200, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_bbox_height(200)[0].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_bbox_height(200, true).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_bbox_height(200)[1].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(csort(r.with_bbox_height(100, nil, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_bbox_height(100, 200, false).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(csort(r.with_bbox_height(nil, 201, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(csort(r.split_with_bbox_height(nil, 201)[0].to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_bbox_height(100, 200, true).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_bbox_height(100, 200)[1].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
|
||||
assert_equal(r.with_bbox_width(400, false).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_bbox_width(400)[0].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.with_bbox_width(400, true).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_bbox_width(400)[1].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(csort(r.with_bbox_width(100, nil, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_bbox_width(100, 400, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(csort(r.with_bbox_width(nil, 401, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(csort(r.split_with_bbox_width(nil, 401)[0].to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_bbox_width(100, 400, true).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_bbox_width(100, 400)[1].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
|
||||
assert_equal(csort(r.with_bbox_min(100, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(csort(r.split_with_bbox_min(100)[0].to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_bbox_min(100, true).to_s, "")
|
||||
assert_equal(r.split_with_bbox_min(100)[1].to_s, "")
|
||||
assert_equal(csort(r.with_bbox_min(100, nil, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(csort(r.with_bbox_min(100, 101, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(csort(r.with_bbox_min(nil, 101, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(csort(r.split_with_bbox_min(nil, 101)[0].to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_bbox_min(100, 101, true).to_s, "")
|
||||
assert_equal(r.split_with_bbox_min(100, 101)[1].to_s, "")
|
||||
|
||||
assert_equal(r.with_bbox_max(200, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_bbox_max(200)[0].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_bbox_max(200, true).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_bbox_max(200)[1].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(csort(r.with_bbox_max(200, nil, false).to_s), csort("(0,0;0,200;100,200;100,0);(0,0;0,100;400,100;400,0)"))
|
||||
assert_equal(r.with_bbox_max(200, 400, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_bbox_max(nil, 400, false).to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.split_with_bbox_max(nil, 400)[0].to_s, "(0,0;0,200;100,200;100,0)")
|
||||
assert_equal(r.with_bbox_max(200, 400, true).to_s, "(0,0;0,100;400,100;400,0)")
|
||||
assert_equal(r.split_with_bbox_max(200, 400)[1].to_s, "(0,0;0,100;400,100;400,0)")
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -840,15 +862,23 @@ class DBRegion_TestClass < TestBase
|
|||
|
||||
r1.merged_semantics = false
|
||||
assert_equal(csort(r1.rectangles.to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(csort(r1.split_rectangles[0].to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(csort(r1.non_rectangles.to_s), csort("(0,0;100,100;100,0);(0,0;0,100;50,100;50,200;100,200;100,0)"))
|
||||
assert_equal(csort(r1.split_rectangles[1].to_s), csort("(0,0;100,100;100,0);(0,0;0,100;50,100;50,200;100,200;100,0)"))
|
||||
assert_equal(csort(r1.rectilinear.to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70);(0,0;0,100;50,100;50,200;100,200;100,0)"))
|
||||
assert_equal(csort(r1.split_rectilinear[0].to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70);(0,0;0,100;50,100;50,200;100,200;100,0)"))
|
||||
assert_equal(r1.non_rectilinear.to_s, "(0,0;100,100;100,0)")
|
||||
assert_equal(r1.split_rectilinear[1].to_s, "(0,0;100,100;100,0)")
|
||||
|
||||
r1.merged_semantics = true
|
||||
assert_equal(r1.rectangles.to_s, "")
|
||||
assert_equal(r1.split_rectangles[0].to_s, "")
|
||||
assert_equal(r1.non_rectangles.to_s, "(0,0;0,100;10,100;10,200;50,200;50,270;150,270;150,70;100,70;100,0)")
|
||||
assert_equal(r1.split_rectangles[1].to_s, "(0,0;0,100;10,100;10,200;50,200;50,270;150,270;150,70;100,70;100,0)")
|
||||
assert_equal(r1.rectilinear.to_s, "(0,0;0,100;10,100;10,200;50,200;50,270;150,270;150,70;100,70;100,0)")
|
||||
assert_equal(r1.split_rectilinear[0].to_s, "(0,0;0,100;10,100;10,200;50,200;50,270;150,270;150,70;100,70;100,0)")
|
||||
assert_equal(r1.non_rectilinear.to_s, "")
|
||||
assert_equal(r1.split_rectilinear[1].to_s, "")
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1188,19 +1218,25 @@ class DBRegion_TestClass < TestBase
|
|||
r.insert(RBA::Box::new(0, 10000, 2000, 12000))
|
||||
|
||||
assert_equal(r.with_bbox_width(1000, false).to_s, "(0,0;0,5000;1000,5000;1000,0)")
|
||||
assert_equal(r.split_with_bbox_width(1000)[0].to_s, "(0,0;0,5000;1000,5000;1000,0)")
|
||||
assert_equal(csort(r.with_bbox_width(1000, true).to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(csort(r.split_with_bbox_width(1000)[1].to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(csort(r.with_bbox_width(1000, 2001, false).to_s), csort("(0,0;0,5000;1000,5000;1000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(r.with_bbox_width(1000, 2000, false).to_s, "(0,0;0,5000;1000,5000;1000,0)")
|
||||
assert_equal(r.with_bbox_width(1000, 2001, true).to_s, "(3000,0;3000,1000;7000,1000;7000,0)")
|
||||
|
||||
assert_equal(r.with_bbox_height(5000, false).to_s, "(0,0;0,5000;1000,5000;1000,0)")
|
||||
assert_equal(r.split_with_bbox_height(5000)[0].to_s, "(0,0;0,5000;1000,5000;1000,0)")
|
||||
assert_equal(csort(r.with_bbox_height(5000, true).to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(csort(r.split_with_bbox_height(5000)[1].to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(csort(r.with_bbox_height(1000, 2001, false).to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(r.with_bbox_height(1000, 1001, false).to_s, "(3000,0;3000,1000;7000,1000;7000,0)")
|
||||
assert_equal(csort(r.with_bbox_height(1000, 1001, true).to_s), csort("(0,0;0,5000;1000,5000;1000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
|
||||
assert_equal(r.with_bbox_aspect_ratio(1.0, false).to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.split_with_bbox_aspect_ratio(1.0)[0].to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(csort(r.with_bbox_aspect_ratio(1.0, true).to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0)"))
|
||||
assert_equal(csort(r.split_with_bbox_aspect_ratio(1.0)[1].to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0)"))
|
||||
assert_equal(r.with_bbox_aspect_ratio(0.9, 1.0, false).to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.with_bbox_aspect_ratio(1.0, 1.1, false).to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.with_bbox_aspect_ratio(0.9, 0.95, false).to_s, "")
|
||||
|
|
@ -1208,7 +1244,9 @@ class DBRegion_TestClass < TestBase
|
|||
assert_equal(r.with_bbox_aspect_ratio(1.0, 1.1, false, false, true).to_s, "")
|
||||
|
||||
assert_equal(r.with_relative_height(1.0, false).to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.split_with_relative_height(1.0)[0].to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(csort(r.with_relative_height(1.0, true).to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0)"))
|
||||
assert_equal(csort(r.split_with_relative_height(1.0)[1].to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0)"))
|
||||
assert_equal(r.with_relative_height(0.9, 1.0, false).to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.with_relative_height(1.0, 1.1, false).to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.with_relative_height(0.9, 0.95, false).to_s, "")
|
||||
|
|
@ -1216,9 +1254,13 @@ class DBRegion_TestClass < TestBase
|
|||
assert_equal(r.with_relative_height(1.0, 1.1, false, false, true).to_s, "")
|
||||
|
||||
assert_equal(csort(r.rectangles.to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(csort(r.split_rectangles[0].to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0);(0,10000;0,12000;2000,12000;2000,10000)"))
|
||||
assert_equal(r.non_rectangles.to_s, "")
|
||||
assert_equal(r.split_rectangles[1].to_s, "")
|
||||
assert_equal(r.squares.to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.split_squares[0].to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(csort(r.non_squares.to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0)"))
|
||||
assert_equal(csort(r.split_squares[1].to_s), csort("(3000,0;3000,1000;7000,1000;7000,0);(0,0;0,5000;1000,5000;1000,0)"))
|
||||
|
||||
r = RBA::Region::new
|
||||
r.insert(RBA::Box::new(0, 0, 1000, 2000))
|
||||
|
|
@ -1226,7 +1268,9 @@ class DBRegion_TestClass < TestBase
|
|||
r.insert(RBA::Box::new(0, 10000, 2000, 12000))
|
||||
|
||||
assert_equal(r.with_area_ratio(1.0, false).to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.split_with_area_ratio(1.0)[0].to_s, "(0,10000;0,12000;2000,12000;2000,10000)")
|
||||
assert_equal(r.with_area_ratio(1.0, true).to_s, "(0,0;0,2000;1000,2000;1000,1000;2000,1000;2000,0)")
|
||||
assert_equal(r.split_with_area_ratio(1.0)[1].to_s, "(0,0;0,2000;1000,2000;1000,1000;2000,1000;2000,0)")
|
||||
assert_equal(r.with_area_ratio(4.0 / 3.0, false).to_s, "(0,0;0,2000;1000,2000;1000,1000;2000,1000;2000,0)")
|
||||
assert_equal(r.with_area_ratio(1.3, 1.4, false).to_s, "(0,0;0,2000;1000,2000;1000,1000;2000,1000;2000,0)")
|
||||
assert_equal(r.with_area_ratio(1.3, 4.0 / 3.0, false, false, true).to_s, "(0,0;0,2000;1000,2000;1000,1000;2000,1000;2000,0)")
|
||||
|
|
@ -1247,11 +1291,17 @@ class DBRegion_TestClass < TestBase
|
|||
r -= rr
|
||||
|
||||
assert_equal(r.with_holes(0, false).to_s, "")
|
||||
assert_equal(r.split_with_holes(0)[0].to_s, "")
|
||||
assert_equal(r.with_holes(0, true).to_s, "(0,0;0,200;100,200;100,0/10,10;20,10;20,20;10,20/30,30;40,30;40,40;30,40)")
|
||||
assert_equal(r.split_with_holes(0)[1].to_s, "(0,0;0,200;100,200;100,0/10,10;20,10;20,20;10,20/30,30;40,30;40,40;30,40)")
|
||||
assert_equal(rr.with_holes(0, false).to_s, "(10,10;10,20;20,20;20,10);(30,30;30,40;40,40;40,30)")
|
||||
assert_equal(rr.split_with_holes(0)[0].to_s, "(10,10;10,20;20,20;20,10);(30,30;30,40;40,40;40,30)")
|
||||
assert_equal(rr.with_holes(0, true).to_s, "")
|
||||
assert_equal(rr.split_with_holes(0)[1].to_s, "")
|
||||
assert_equal(rr.with_holes(2, false).to_s, "")
|
||||
assert_equal(rr.split_with_holes(2)[0].to_s, "")
|
||||
assert_equal(r.with_holes(1, 3, false).to_s, "(0,0;0,200;100,200;100,0/10,10;20,10;20,20;10,20/30,30;40,30;40,40;30,40)")
|
||||
assert_equal(r.split_with_holes(1, 3)[0].to_s, "(0,0;0,200;100,200;100,0/10,10;20,10;20,20;10,20/30,30;40,30;40,40;30,40)")
|
||||
assert_equal(r.with_holes(2, 3, false).to_s, "(0,0;0,200;100,200;100,0/10,10;20,10;20,20;10,20/30,30;40,30;40,40;30,40)")
|
||||
assert_equal(r.with_holes(1, 2, false).to_s, "")
|
||||
|
||||
|
|
@ -1349,6 +1399,8 @@ class DBRegion_TestClass < TestBase
|
|||
region.insert(RBA::Box::new(200, 0, 300, 100))
|
||||
|
||||
assert_equal(region.filtered(TriangleFilter::new).to_s, "(0,0;100,100;100,0)")
|
||||
assert_equal(region.split_filter(TriangleFilter::new)[0].to_s, "(0,0;100,100;100,0)")
|
||||
assert_equal(region.split_filter(TriangleFilter::new)[1].to_s, "(200,0;200,100;300,100;300,0)")
|
||||
assert_equal(region.to_s, "(0,0;100,100;100,0);(200,0;200,100;300,100;300,0)")
|
||||
region.filter(TriangleFilter::new)
|
||||
assert_equal(region.to_s, "(0,0;100,100;100,0)")
|
||||
|
|
|
|||
|
|
@ -179,9 +179,13 @@ class DBTexts_TestClass < TestBase
|
|||
r1 = RBA::Texts::new([ text1, text2 ])
|
||||
assert_equal(csort(r1.to_s), csort("('abc',r0 100,-200);('uvm',r0 110,210)"))
|
||||
assert_equal(r1.with_text("abc", false).to_s, "('abc',r0 100,-200)")
|
||||
assert_equal(r1.split_with_text("abc")[0].to_s, "('abc',r0 100,-200)")
|
||||
assert_equal(r1.with_text("abc", true).to_s, "('uvm',r0 110,210)")
|
||||
assert_equal(r1.split_with_text("abc")[1].to_s, "('uvm',r0 110,210)")
|
||||
assert_equal(r1.with_match("*b*", false).to_s, "('abc',r0 100,-200)")
|
||||
assert_equal(r1.split_with_match("*b*")[0].to_s, "('abc',r0 100,-200)")
|
||||
assert_equal(r1.with_match("*b*", true).to_s, "('uvm',r0 110,210)")
|
||||
assert_equal(r1.split_with_match("*b*")[1].to_s, "('uvm',r0 110,210)")
|
||||
|
||||
r1 = RBA::Texts::new(text1)
|
||||
assert_equal(r1.to_s, "('abc',r0 100,-200)")
|
||||
|
|
@ -394,6 +398,8 @@ class DBTexts_TestClass < TestBase
|
|||
texts.insert(RBA::Text::new("00", [ RBA::Trans::R90, 0, 20 ]))
|
||||
|
||||
assert_equal(texts.filtered(f).to_s, "('tla',r0 0,0)")
|
||||
assert_equal(texts.split_filter(f)[0].to_s, "('tla',r0 0,0)")
|
||||
assert_equal(texts.split_filter(f)[1].to_s, "('long',m45 10,0);('00',r90 0,20)")
|
||||
assert_equal(texts.to_s, "('long',m45 10,0);('tla',r0 0,0);('00',r90 0,20)")
|
||||
texts.filter(f)
|
||||
assert_equal(texts.to_s, "('tla',r0 0,0)")
|
||||
|
|
|
|||
Loading…
Reference in New Issue