mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-07 13:18:19 +08:00
0030645: Modeling Algorithms - B-spline segmentation produces wrong parametrization
Method Segment() of B-spline curve and surface has been extended by parameter theTolerance (theUTolerance and theVTolerance for surface), which defines the proximity between knots of a NURBS and boundaries of cutting segment. The default value of the tolerance is Precision::PConfusion(). Test cases have been added to check segmenting of B-spline surface and curves both 2D and 3D.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
puts "========"
|
||||
puts "0030645: Modeling Algorithms - B-spline segmentation produces wrong parametrization"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug30645.brep] result
|
||||
|
||||
set tolerance 1.e-9
|
||||
segsur result 13.527990713022374 14.030423915738853 54.831990159753303 59.000000000000028 $tolerance
|
||||
|
||||
set surf [dump result]
|
||||
|
||||
regexp {VKnots +:\n(.*)} $surf full vknots
|
||||
set is_different_knots 1
|
||||
set vknots_list {}
|
||||
while { "$vknots" != "\n\n" && $is_different_knots } {
|
||||
regexp { +([0-9]+) +: +([-0-9.+eE]+) *([0-9]+)\n(.*)} $vknots full index knot weight rest
|
||||
foreach k $vknots_list {
|
||||
if { [expr abs($k - $knot)] < $tolerance } {
|
||||
set is_different_knots 0
|
||||
}
|
||||
}
|
||||
|
||||
lappend vknots_list $knot
|
||||
set vknots $rest
|
||||
}
|
||||
|
||||
if { $is_different_knots } {
|
||||
puts "OK: all knots are different"
|
||||
} else {
|
||||
puts "ERROR: segment has knots too close"
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
puts "========"
|
||||
puts "0030645: Modeling Algorithms - B-spline segmentation produces wrong parametrization"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
bsplinecurve result 3 4 \
|
||||
2.0 4 2.5 2 2.9 2 3.0 4 \
|
||||
117.9 0.0 11.6 1 \
|
||||
116.7 0.0 11 1 \
|
||||
115.8 0.0 10.5 1 \
|
||||
114.4 0.0 9.7 1 \
|
||||
113.9 0.0 9.4 1 \
|
||||
113.3 0.0 9.1 1 \
|
||||
113.1 0.0 9.0 1 \
|
||||
113.0 0.0 8.9 1
|
||||
|
||||
|
||||
set tolerance 2.e-9
|
||||
segment result 2.5 2.900000001 $tolerance
|
||||
|
||||
set crv [dump result]
|
||||
|
||||
regexp {Knots +:\n(.*)} $crv full knots
|
||||
set is_different_knots 1
|
||||
set knots_list {}
|
||||
while { "$knots" != "\n" && $is_different_knots } {
|
||||
regexp { +([0-9]+) +: +([-0-9.+eE]+) *([0-9]+)\n(.*)} $knots full index knot weight rest
|
||||
foreach k $knots_list {
|
||||
if { [expr abs($k - $knot)] < $tolerance } {
|
||||
set is_different_knots 0
|
||||
}
|
||||
}
|
||||
|
||||
lappend knots_list $knot
|
||||
set knots $rest
|
||||
}
|
||||
|
||||
if { $is_different_knots } {
|
||||
puts "OK: all knots are different"
|
||||
} else {
|
||||
puts "ERROR: segment has knots too close"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
puts "========"
|
||||
puts "0030645: Modeling Algorithms - B-spline segmentation produces wrong parametrization"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
2dbsplinecurve result 3 4 \
|
||||
2.0 4 2.5 2 2.9 2 3.0 4 \
|
||||
117.9 11.6 1 \
|
||||
116.7 11 1 \
|
||||
115.8 10.5 1 \
|
||||
114.4 9.7 1 \
|
||||
113.9 9.4 1 \
|
||||
113.3 9.1 1 \
|
||||
113.1 9.0 1 \
|
||||
113.0 8.9 1
|
||||
|
||||
|
||||
set tolerance 1.e-9
|
||||
segment result 2.5 2.900000000001 $tolerance
|
||||
|
||||
set crv [dump result]
|
||||
|
||||
regexp {Knots +:\n(.*)} $crv full knots
|
||||
set is_different_knots 1
|
||||
set knots_list {}
|
||||
while { "$knots" != "\n" && $is_different_knots } {
|
||||
regexp { +([0-9]+) +: +([-0-9.+eE]+) *([0-9]+)\n(.*)} $knots full index knot weight rest
|
||||
puts $knot
|
||||
puts $rest
|
||||
foreach k $knots_list {
|
||||
if { [expr abs($k - $knot)] < $tolerance } {
|
||||
set is_different_knots 0
|
||||
}
|
||||
}
|
||||
|
||||
lappend knots_list $knot
|
||||
set knots $rest
|
||||
}
|
||||
|
||||
if { $is_different_knots } {
|
||||
puts "OK: all knots are different"
|
||||
} else {
|
||||
puts "ERROR: segment has knots too close"
|
||||
}
|
||||
Reference in New Issue
Block a user