? 3D projection (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

3D projection

  • #1 ✎ 77 dfrost2 Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Minecraft Is Awesome! I love Minecraft! Express Yourself could someone make a DEF block for perspective projection, please Posted
  • #2 ✎ 246 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength DEF DRAW_WIRE_RECTPRISM GLINE 200-8,120-8,200+8,120-8,#RED GLINE 200-8,120+8,200+8,120+8,#RED GLINE 200-8,120-8,200-8,120+8,#RED GLINE 200+8,120-8,200+8,120+8,#RED GLINE 200-4,120-4,200+4,120-4,RGB(90,0,0) GLINE 200-4,120+4,200+4,120+4,RGB(90,0,0) GLINE 200-4,120-4,200-4,120+4,RGB(90,0,0) GLINE 200+4,120-4,200+4,120+4,RGB(90,0,0) GLINE 200-8,120-8,200-4,120-4,RGB(175,0,0) GLINE 200+8,120-8,200+4,120-4,RGB(175,0,0) GLINE 200-8,120+8,200-4,120+4,RGB(175,0,0) GLINE 200+8,120+8,200+4,120+4,RGB(175,0,0) END Draws a tiny red "cube" shape. You can see the lines get darker making it look like it has depth Posted Edited by spaceturtles
  • #3 ✎ 77 dfrost2 Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Minecraft Is Awesome! I love Minecraft! Express Yourself i want a function: DEF PERSPECTIVE X,Y,Z OUT X2,Y2 'code END Posted
  • #4 ✎ 165 Nathaniel Spring 2017 Contest Winner I won the SmileBASIC Source Spring 2017 Contest! Programming Contest Staff Pick "Your program is one of our favorites!" - Staff Achievements Helper Received for being very helpful around SmileBASIC Source Achievements DEF PERSPECTIVE X,Y,Z,VP OUT X2,Y2 X2=X/(Z-VP) Y2=Y/(Z-VP) END VP is the vanishing point distance. No "z" value should be bigger than this number and this number should be consistent for all calculations. Posted Edited by Nathaniel
  • #5 ✎ 77 dfrost2 Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Minecraft Is Awesome! I love Minecraft! Express Yourself what about rotation? Posted
  • #6 ✎ 165 Nathaniel Spring 2017 Contest Winner I won the SmileBASIC Source Spring 2017 Contest! Programming Contest Staff Pick "Your program is one of our favorites!" - Staff Achievements Helper Received for being very helpful around SmileBASIC Source Achievements This is the function I usually use for two-axis rotation. DEF ROT_3D X,Y,Z,A1,A2 OUT X3,Y3,Z3 VAR W=SIN(RAD(A1)),W2=SIN(RAD(A2)) VAR H=COS(RAD(A1)),H2=COS(RAD(A2)) VAR Z2=Z*H-X*W X3=Z*W+X*H Y3=Y*H2-Z2*W2 Z3=Y*W2+Z2*H2 END It's also faster if you calculate all the sin/cos calculation before you calculate all the point's locations. Posted
  • #7 ✎ 395 random_god Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Video Games I like to play video games! Hobbies Cool. Posted