 # Geometrical calculations : points, lines, planes : intersections, distances, angles

#61

Hi Klvnk,

very interesting functions. As i’m not familiar with geometry data structure, can you please give a usage example ?
How to build a struct vertex for any given mesh ?
I was thinking about that :

``````- sm = snapshotasmesh (Teapot())
- loop through each vert and get :
p = meshop.getvert sm v
n = getnormal sm v
col = -- vertex color ?
uvw1 = getTVert sm <tvert_index_integer> -- how to get tvert from current vert ?
- build array of faces indices :
fi = for f=1 to sm.numfaces collect ((meshop.getVertsUsingFace sm f) as array)
- once i got my vertex array struct, i can call your functions :
ComputeTangents myVertStruct fi
``````

Sorry if i bother with noob question

#62

yep that kind of thing will do it, I’ll start a new thread with an example.

#63
``````yep that kind of thing will do it, I'll start a new thread with an example.
``````

thanks !

#64

randomize a normal…

#65

simple but was quite tricky to find…

pos is the position of the base of the cone and pnt is the position of the point on the cone, r & h are the radius and height respectively

#66 :applause: :applause:

#67

I apparently annoyed the wrong people on stackoverflow so perhaps i’ll get more joy here. If I have a plane in the YZ plane and want to project it onto a sphere, what equation do I use for the X axis? #68

one more modification ``````fn rotatePointAroundCenter center dir radius steps:8 debug:false = (

local tm = (matrixFromNormal dir)