I am currently working on a 3D model viewer for petit computer. As of right now, I have very basic wireframe support working, and am now working on the code for rotation. However, I am having quite a bit of difficulty rotating the model, and was wondering if I could get some help with the required code. Here's what I need the code to do.
There will be three subroutines, and each one will be nearly identical, but will be for rotating the model around different axes.
When called, the code will go through all points in the array POINTA, and rotate them by DEGREES about an axis. Following this, it will save that data back into the array, and return.
The coordinates for my program are stored in DATA fields initially, to allow me to import .ply files from the computer, in the following format:
DATA X,Y,Z,X2,Y2,Z2,X3,Y3,Z3
Each row of data is one face on the 3D model. This information is then pulled and saved into the already mentioned array, POINTA, where it will need to be pulled out and rotated.
'READS 3D MODEL INFO @DATPARSE
READ POINTP
'CHECKS FOR END OF DATA
IF POINTP != 999 THEN POINTC = POINTC+1 : GOTO @DATPARSE ELSE RESTORE @DATALABEL : READ POINTP
'CREATES ARRAY FOR DATA
DIM POINTA(POLYGONSIZE+1,POINTC/POLYGONSIZE+1)
Forums
Topic: Rotating points around the origin in Petit Computer
Posts 1 to 2 of 2
This topic has been archived, no further posts can be added.