diff --git a/src/forcad_nurbs_curve.f90 b/src/forcad_nurbs_curve.f90 index b3a78b0cf..3c3e2337b 100644 --- a/src/forcad_nurbs_curve.f90 +++ b/src/forcad_nurbs_curve.f90 @@ -1145,13 +1145,13 @@ pure subroutine set_circle(this, center, radius) ! Define control points for circle allocate(Xc(7, 3)) - Xc(1,:)= [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(2,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(3,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(4,:)= [-2.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(5,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(6,:)= [ 1.0_rk/2.0_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(7,:)= [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] + Xc(1,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] + Xc(2,:)= [ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(3,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(4,:)= [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(5,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(6,:)= [ 1.0_rk, -sqrt(3.0_rk), 0.0_rk] + Xc(7,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] ! Scale and translate the control points do i = 1, size(Xc, 1) diff --git a/src/forcad_nurbs_surface.f90 b/src/forcad_nurbs_surface.f90 index 82176ea05..fb64792ea 100644 --- a/src/forcad_nurbs_surface.f90 +++ b/src/forcad_nurbs_surface.f90 @@ -1919,27 +1919,29 @@ pure subroutine set_ring(this, center, radius1, radius2) ! Define control points for ring allocate(Xc(14, 3)) - Xc(1,:) = [ 1.0_rk/2.0_rk, 0.0_rk,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[ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(10,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(11,:)= [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(12,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(13,:)= [ 1.0_rk, -sqrt(3.0_rk), 0.0_rk] + Xc(14,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] Xc(8:14,1:2) = Xc(8:14,1:2) * radius2 - ! Scale and translate the control points + ! Translate the control points do i = 1, size(Xc, 1) - Xc(i,:) = center + Xc(i,:) * radius1 + Xc(i,:) = center + Xc(i,:) end do ! Define weights for the control points @@ -1968,23 +1970,25 @@ pure subroutine set_C(this, center, radius1, radius2) ! Define control points for C-shape allocate(Xc(10, 3)) - Xc(1,:)= [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(2,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(3,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(4,:)= [-2.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(5,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, 0.0_rk] - - Xc(6,:)= [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(7,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(8,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(9,:)= [-2.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(10,:)=[-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, 0.0_rk] + Xc(1,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] + Xc(2,:)= [ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(3,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(4,:)= [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(5,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] + + Xc(1:5,1:2) = Xc(1:5,1:2) * radius1 + + Xc(6,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] + Xc(7,:)= [ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(8,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(9,:)= [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(10,:)=[-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] Xc(6:10,1:2) = Xc(6:10,1:2) * radius2 - ! Scale and translate the control points + ! Translate the control points do i = 1, size(Xc, 1) - Xc(i,:) = center + Xc(i,:) * radius1 + Xc(i,:) = center + Xc(i,:) end do ! Define weights for the control points @@ -2019,6 +2023,8 @@ pure subroutine set_half_ring(this, center, radius1, radius2) Xc(4,:) = [-0.5_rk, 0.5_rk, 0.0_rk] Xc(5,:) = [-0.5_rk, 0.0_rk, 0.0_rk] + Xc(1:5,1:2) = Xc(1:5,1:2) * radius1 + Xc(6,:) = [ 0.5_rk, 0.0_rk, 0.0_rk] Xc(7,:) = [ 0.5_rk, 0.5_rk, 0.0_rk] Xc(8,:) = [ 0.0_rk, 0.5_rk, 0.0_rk] @@ -2027,9 +2033,9 @@ pure subroutine set_half_ring(this, center, radius1, radius2) Xc(6:10,1:2) = Xc(6:10,1:2) * radius2 - ! Scale and translate the control points + ! Translate the control points do i = 1, size(Xc, 1) - Xc(i,:) = center + Xc(i,:) * radius1 + Xc(i,:) = center + Xc(i,:) end do ! Define weights for the control points diff --git a/src/forcad_nurbs_volume.f90 b/src/forcad_nurbs_volume.f90 index 512066a40..0a485c933 100644 --- a/src/forcad_nurbs_volume.f90 +++ b/src/forcad_nurbs_volume.f90 @@ -2357,45 +2357,49 @@ pure subroutine set_ring(this, center, radius1, radius2, length) ! Define control points for ring allocate(Xc(28, 3)) - Xc(1,:) = [ 1.0_rk/2.0_rk, 0.0_rk/2.0_rk, 0.0_rk] - Xc(2,:) = [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(3,:) = [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(4,:) = [-2.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(5,:) = [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(6,:) = [ 1.0_rk/2.0_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(7,:) = [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - - Xc(8,:) = [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(9,:) = [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(10,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(11,:)= [-2.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(12,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(13,:)= [ 1.0_rk/2.0_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(14,:)= [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] + Xc(1,:) = [ 1.0_rk, 0.0_rk, 0.0_rk] + Xc(2,:) = [ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(3,:) = [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(4,:) = [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(5,:) = [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(6,:) = [ 1.0_rk, -sqrt(3.0_rk), 0.0_rk] + Xc(7,:) = [ 1.0_rk, 0.0_rk, 0.0_rk] + + Xc(1:7,1:2) = Xc(1:7,1:2) * radius1 + + Xc(8,:) = [ 1.0_rk, 0.0_rk, 0.0_rk] + Xc(9,:) = [ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(10,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(11,:)= [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(12,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(13,:)= [ 1.0_rk, -sqrt(3.0_rk), 0.0_rk] + Xc(14,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] Xc(8:14,1:2) = Xc(8:14,1:2) * radius2 - Xc(15,:)= [ 1.0_rk/2.0_rk, 0.0_rk, length] - Xc(16,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, length] - Xc(17,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, length] - Xc(18,:)= [-2.0_rk/2.0_rk, 0.0_rk, length] - Xc(19,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, length] - Xc(20,:)= [ 1.0_rk/2.0_rk, -sqrt(3.0_rk)/2.0_rk, length] - Xc(21,:)= [ 1.0_rk/2.0_rk, 0.0_rk, length] - - Xc(22,:)= [ 1.0_rk/2.0_rk, 0.0_rk, length] - Xc(23,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, length] - Xc(24,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, length] - Xc(25,:)= [-2.0_rk/2.0_rk, 0.0_rk, length] - Xc(26,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, length] - Xc(27,:)= [ 1.0_rk/2.0_rk, -sqrt(3.0_rk)/2.0_rk, length] - Xc(28,:)= [ 1.0_rk/2.0_rk, 0.0_rk, length] + Xc(15,:)= [ 1.0_rk, 0.0_rk, length] + Xc(16,:)= [ 1.0_rk, sqrt(3.0_rk), length] + Xc(17,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, length] + Xc(18,:)= [-2.0_rk, 0.0_rk, length] + Xc(19,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, length] + Xc(20,:)= [ 1.0_rk, -sqrt(3.0_rk), length] + Xc(21,:)= [ 1.0_rk, 0.0_rk, length] + + Xc(15:21,1:2) = Xc(15:21,1:2) * radius1 + + Xc(22,:)= [ 1.0_rk, 0.0_rk, length] + Xc(23,:)= [ 1.0_rk, sqrt(3.0_rk), length] + Xc(24,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, length] + Xc(25,:)= [-2.0_rk, 0.0_rk, length] + Xc(26,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, length] + Xc(27,:)= [ 1.0_rk, -sqrt(3.0_rk), length] + Xc(28,:)= [ 1.0_rk, 0.0_rk, length] Xc(22:28,1:2) = Xc(22:28,1:2) * radius2 - ! Scale and translate the control points + ! Translate the control points do i = 1, size(Xc, 1) - Xc(i,:) = center + Xc(i,:) * radius1 + Xc(i,:) = center + Xc(i,:) end do ! Define weights for the control points @@ -2427,37 +2431,41 @@ pure subroutine set_C(this, center, radius1, radius2, length) ! Define control points for C-shape allocate(Xc(20, 3)) - Xc(1,:)= [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(2,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(3,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(4,:)= [-2.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(5,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, 0.0_rk] - - Xc(6,:)= [ 1.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(7,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] - Xc(8,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, 0.0_rk] - Xc(9,:)= [-2.0_rk/2.0_rk, 0.0_rk, 0.0_rk] - Xc(10,:)=[-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, 0.0_rk] + Xc(1,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] + Xc(2,:)= [ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(3,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(4,:)= [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(5,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] + + Xc(1:5,1:2) = Xc(1:5,1:2) * radius1 + + Xc(6,:)= [ 1.0_rk, 0.0_rk, 0.0_rk] + Xc(7,:)= [ 1.0_rk, sqrt(3.0_rk), 0.0_rk] + Xc(8,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, 0.0_rk] + Xc(9,:)= [-2.0_rk, 0.0_rk, 0.0_rk] + Xc(10,:)=[-0.5_rk, -sqrt(3.0_rk)/2.0_rk, 0.0_rk] Xc(6:10,1:2) = Xc(6:10,1:2) * radius2 - Xc(11,:)= [ 1.0_rk/2.0_rk, 0.0_rk, length] - Xc(12,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, length] - Xc(13,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, length] - Xc(14,:)= [-2.0_rk/2.0_rk, 0.0_rk, length] - Xc(15,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, length] + Xc(11,:)= [ 1.0_rk, 0.0_rk, length] + Xc(12,:)= [ 1.0_rk, sqrt(3.0_rk), length] + Xc(13,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, length] + Xc(14,:)= [-2.0_rk, 0.0_rk, length] + Xc(15,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, length] - Xc(16,:)= [ 1.0_rk/2.0_rk, 0.0_rk, length] - Xc(17,:)= [ 1.0_rk/2.0_rk, sqrt(3.0_rk)/2.0_rk, length] - Xc(18,:)= [-0.5_rk/2.0_rk, sqrt(3.0_rk)/4.0_rk, length] - Xc(19,:)= [-2.0_rk/2.0_rk, 0.0_rk, length] - Xc(20,:)= [-0.5_rk/2.0_rk, -sqrt(3.0_rk)/4.0_rk, length] + Xc(11:15,1:2) = Xc(11:15,1:2) * radius1 + + Xc(16,:)= [ 1.0_rk, 0.0_rk, length] + Xc(17,:)= [ 1.0_rk, sqrt(3.0_rk), length] + Xc(18,:)= [-0.5_rk, sqrt(3.0_rk)/2.0_rk, length] + Xc(19,:)= [-2.0_rk, 0.0_rk, length] + Xc(20,:)= [-0.5_rk, -sqrt(3.0_rk)/2.0_rk, length] Xc(16:20,1:2) = Xc(16:20,1:2) * radius2 - ! Scale and translate the control points + ! Translate the control points do i = 1, size(Xc, 1) - Xc(i,:) = center + Xc(i,:) * radius1 + Xc(i,:) = center + Xc(i,:) end do ! Define weights for the control points @@ -2495,6 +2503,8 @@ pure subroutine set_half_ring(this, center, radius1, radius2, length) Xc(4,:) = [-0.5_rk, 0.5_rk, 0.0_rk] Xc(5,:) = [-0.5_rk, 0.0_rk, 0.0_rk] + Xc(1:5,1:2) = Xc(1:5,1:2) * radius1 + Xc(6,:) = [ 0.5_rk, 0.0_rk, 0.0_rk] Xc(7,:) = [ 0.5_rk, 0.5_rk, 0.0_rk] Xc(8,:) = [ 0.0_rk, 0.5_rk, 0.0_rk] @@ -2509,6 +2519,8 @@ pure subroutine set_half_ring(this, center, radius1, radius2, length) Xc(14,:) = [-0.5_rk, 0.5_rk, length] Xc(15,:) = [-0.5_rk, 0.0_rk, length] + Xc(11:15,1:2) = Xc(11:15,1:2) * radius1 + Xc(16,:) = [ 0.5_rk, 0.0_rk, length] Xc(17,:) = [ 0.5_rk, 0.5_rk, length] Xc(18,:) = [ 0.0_rk, 0.5_rk, length] @@ -2517,9 +2529,9 @@ pure subroutine set_half_ring(this, center, radius1, radius2, length) Xc(16:20,1:2) = Xc(16:20,1:2) * radius2 - ! Scale and translate the control points + ! Translate the control points do i = 1, size(Xc, 1) - Xc(i,:) = center + Xc(i,:) * radius1 + Xc(i,:) = center + Xc(i,:) end do ! Define weights for the control points