mirror of https://github.com/KLayout/klayout.git
Added EdgePair#distance
This commit is contained in:
parent
ce77909c3f
commit
d5f484bf92
|
|
@ -169,6 +169,14 @@ struct edge_pair_defs
|
||||||
method ("bbox", &C::bbox,
|
method ("bbox", &C::bbox,
|
||||||
"@brief Gets the bounding box of the edge pair\n"
|
"@brief Gets the bounding box of the edge pair\n"
|
||||||
) +
|
) +
|
||||||
|
method ("distance", &C::distance,
|
||||||
|
"@brief Gets the distance of the edges in the edge pair\n"
|
||||||
|
"\n"
|
||||||
|
"The distance between the two edges is defined as the minimum distance between any "
|
||||||
|
"two points on the two edges.\n"
|
||||||
|
"\n"
|
||||||
|
"This attribute has been introduced in version 0.28.14."
|
||||||
|
) +
|
||||||
method ("perimeter", &C::perimeter,
|
method ("perimeter", &C::perimeter,
|
||||||
"@brief Gets the perimeter of the edge pair\n"
|
"@brief Gets the perimeter of the edge pair\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ class DBEdgePair_TestClass < TestBase
|
||||||
|
|
||||||
ep = RBA::EdgePair::new(RBA::Edge::new(0, 0, 10, 0), RBA::Edge::new(0, 20, 0, 0))
|
ep = RBA::EdgePair::new(RBA::Edge::new(0, 0, 10, 0), RBA::Edge::new(0, 20, 0, 0))
|
||||||
|
|
||||||
|
assert_equal(ep.distance, 0)
|
||||||
assert_equal(ep.perimeter, 30)
|
assert_equal(ep.perimeter, 30)
|
||||||
assert_equal(ep.area, 100)
|
assert_equal(ep.area, 100)
|
||||||
assert_equal(ep.simple_polygon(0).area, 100)
|
assert_equal(ep.simple_polygon(0).area, 100)
|
||||||
|
|
@ -71,6 +72,10 @@ class DBEdgePair_TestClass < TestBase
|
||||||
assert_equal(ep.area, 0)
|
assert_equal(ep.area, 0)
|
||||||
assert_equal(ep.simple_polygon(0).area, 0)
|
assert_equal(ep.simple_polygon(0).area, 0)
|
||||||
|
|
||||||
|
ep = RBA::EdgePair::new(RBA::Edge::new(0, 0, 10, 0), RBA::Edge::new(-10, 10, 20, 10))
|
||||||
|
|
||||||
|
assert_equal(ep.distance, 10)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Basics
|
# Basics
|
||||||
|
|
@ -108,6 +113,7 @@ class DBEdgePair_TestClass < TestBase
|
||||||
|
|
||||||
ep = RBA::DEdgePair::new(RBA::DEdge::new(0, 0, 10, 0), RBA::DEdge::new(0, 20, 0, 0))
|
ep = RBA::DEdgePair::new(RBA::DEdge::new(0, 0, 10, 0), RBA::DEdge::new(0, 20, 0, 0))
|
||||||
|
|
||||||
|
assert_equal(ep.distance, 0)
|
||||||
assert_equal(ep.perimeter, 30)
|
assert_equal(ep.perimeter, 30)
|
||||||
assert_equal(ep.area, 100)
|
assert_equal(ep.area, 100)
|
||||||
assert_equal(ep.simple_polygon(0).area, 100)
|
assert_equal(ep.simple_polygon(0).area, 100)
|
||||||
|
|
@ -118,6 +124,10 @@ class DBEdgePair_TestClass < TestBase
|
||||||
assert_equal(ep.area, 0)
|
assert_equal(ep.area, 0)
|
||||||
assert_equal(ep.simple_polygon(0).area, 0)
|
assert_equal(ep.simple_polygon(0).area, 0)
|
||||||
|
|
||||||
|
ep = RBA::DEdgePair::new(RBA::DEdge::new(0, 0, 10, 0), RBA::DEdge::new(-10, 10, 20, 10))
|
||||||
|
|
||||||
|
assert_equal(ep.distance, 10)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fuzzy compare
|
# Fuzzy compare
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue