This repository has been archived by the owner on Jul 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
GeneralGuy4872
committed
Jan 1, 2020
1 parent
94baa5f
commit 6d520c9
Showing
3 changed files
with
57 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
ucoord3list * bline (ucoord3 p1, ucoord3 p2) { | ||
float deltax = p2[0] - p1[0]; | ||
int signx = sgnf(deltax); | ||
float deltay = p2[1] - p1[1]; | ||
int signy = sgnf(deltay); | ||
float deltaz = p2[2] - p1[2]; | ||
int signz = sgnf(deltaz); | ||
ucoordlist3 * output = ucoordlist3__new(p1); | ||
ucoordlist3 * output_tail = output; | ||
|
||
if ( (fabs(deltay) ≤ 1.0) && (fabs(deltaz) ≤ 1.0) ) { | ||
float deltaerrory = fabs(deltay / deltax); | ||
float errory = 0.0; | ||
float deltaerrorz = fabs(deltaz / deltax); | ||
float errorz = 0.0; | ||
int x,y,z; | ||
forever { | ||
output_tail = ucoordlist3__tail_push_int(output_tail,x,y,z); | ||
errory += deltaerrory; | ||
if (errory ≥ 0.5) {y += signy;} | ||
errorz += deltaerrorz; | ||
if (errorz ≥ 0.5) {z += signz;} | ||
x += signz; | ||
if (signx < 0) { | ||
if (x ≤ p2[0]) {return output} | ||
} else { | ||
if (x ≥ p2[0] {return output} | ||
} | ||
} | ||
|
||
/*same for y, z*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters