Research Article

Developing a Tile-Based Rendering Method to Improve Rendering Speed of 3D Geospatial Data with HTML5 and WebGL

Algorithm 1

Computer code for object splitting.
(1) function DivideFaceNormal(idx, facelist)
(2)
(3)//declare variables
(4)u16i0, i1, i2; // triangular’s node Index
(5)S3DVertex v0, v1, v2; // triangular’s Vertex
(6)vector3df sub0, sub1, sub2; // face’s point
(7)vector3df sv; // face(Triangular)
(8)vector3df norm; // face’s normal vector
(9)floatsd; // plane
(10)
(11)//One face consists of three points. Divide the total number of nodes by 3.
(12)for (j=0 to all triangular count)
(13)
(14)//Use the value divided by 3, multiply by 3 to obtain the index.
(15)i0 = first triangular node; //first node
(16)i1 = second triangular node; //second node
(17)i2 = third triangular node; //third node
(18)
(19)//Vertex information is obtained using the node information.
(20)v0 = first vertex of node;
(21)v1 = second vertex of node;
(22)v2 = third vertex of node;
(23)
(24)//Get triangle information.
(25)sub0 = v0 - v1;
(26)sub1 = v1 - v2;
(27)sub2 = v2 - v0;
(28)
(29)create norm is normal vector of sub0; //Find the normal vector of the triangle.
(30)set 3dplane is (v0 point, norm); //3d plane containing a triangle
(31)
(32)l = -1;
(33)set List = list of norm; //Normal vector list
(34)for (k = 0 to List)
(35)//Calculate the normal vector direction value
(36)sv = (normal vector of list[k]) - norm;
(37)sd = (plane direction of list[k]) - (directoin of 3dplane);
(38)
(39)if (sv.x is almost to 0 and sv.y is almost to 0 and sv.z is almost to 0)
(40)l=k;
(41)add triangular vertex (v0, v1, v2);
(42)break;
(43)
(44)
(45)
(46)
(47)//If the normal vector does not have similar faces, create a new one.
(48)if(l == -1)
(49)create NF is New face; //Create new face
(50)set NF plane is (v0 point, norm); //input face’s information
(51)insert triangular vertex(v0, v1, v2) into NF;
(52)insert NF into list;
(53)
(54)