Matrices, vertices and polygons

Started by
0 comments, last by Illco 19 years ago
I've recently been thinking of using matrices for transformations in a 3d-environment. Think of translation, scaling and rotation. I realise all coordinates of the points that I'd store (every vertex) should be transformed using the matrices. Because of that, I'm thinking of ways to logically store all vertices (and hopefully, effectively). If I were to store every polygon and with it all needed vertices (example; triangle - 3 vertices), I'd have a lot of double stored vertices when one vertex is used in multiple polygons. So I started thinking again. What if I were to store all vertices and polygons seperately - but with the polygons I'd store a pointer, or location, to what vertices it uses? Would this method be beneficial in any way, such as usage of less memory? Another thing I was thinking of; what if I wanted to store all objects coordinates using a decent precision (let's say double). I could store the object's position as a double and store it's vertices with float precision (but then relative to the object's position, which would result in smaller numbers used for the vertices - thus less trouble of data loss). When drawing, ofcourse, all vertices would have to be translated using the object's position. Would this be in any way benificial, such as less memory used because you store the vertices with less precision? Note that for this question, precision is less important for the real vertices positions than for the object's position. I welcome any thoughts or tips on the matter. ~Stemic
Advertisement
Don't invent wheels that exist, I'd say. As for your first suggestion, the usual approach is not by pointers but by indices. That is, the vertices are stored in a list (usually a vertex buffer). Then, a second list (index buffer) stores the faces. Each face consists of three indices into the vertex list. As for the second suggestion, unless you are doing anything funky, precision is generally totally not of concern and floats are usually very sufficient.

Greetz,

Illco

PS: you could have read this in any 3D graphics package documentation, online websites or a decent book.

This topic is closed to new replies.

Advertisement