Skip to content

Commit

Permalink
Fix control points of some predefined shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
gha3mi committed Apr 18, 2024
1 parent 084c9b1 commit a2aa9aa
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 85 deletions.
14 changes: 7 additions & 7 deletions src/forcad_nurbs_curve.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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,:)= [ 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]

! Scale and translate the control points
do i = 1, size(Xc, 1)
Expand Down
52 changes: 26 additions & 26 deletions src/forcad_nurbs_surface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1919,21 +1919,21 @@ pure subroutine set_ring(this, center, radius1, radius2)

! Define control points for ring
allocate(Xc(14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)= [-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(8:14,1:2) = Xc(8:14,1:2) * radius2

Expand Down Expand Up @@ -1968,17 +1968,17 @@ pure subroutine set_C(this, center, radius1, radius2)

! Define control points for C-shape
allocate(Xc(10, 3))
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, 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(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(6:10,1:2) = Xc(6:10,1:2) * radius2

Expand Down
104 changes: 52 additions & 52 deletions src/forcad_nurbs_volume.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2357,39 +2357,39 @@ pure subroutine set_ring(this, center, radius1, radius2, length)

! Define control points for ring
allocate(Xc(28, 3))
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(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(1,:) = [ 1.0_rk/2.0_rk, 0.0_rk/2.0_rk, 0.0_rk]
Xc(2,:) = [ 1.0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-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(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(22:28,1:2) = Xc(22:28,1:2) * radius2

Expand Down Expand Up @@ -2427,31 +2427,31 @@ pure subroutine set_C(this, center, radius1, radius2, length)

! Define control points for C-shape
allocate(Xc(20, 3))
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, -s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(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(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(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(16:20,1:2) = Xc(16:20,1:2) * radius2

Expand Down

0 comments on commit a2aa9aa

Please sign in to comment.