In example - drawing smal "floor" chunk with two triangles:

Code :

triangles.add(new Triangle(new Vector3f(x, (float) map[x][z] * 100, z),
new Vector3f(+0.5f, 1, -0.5f),
new Vector3f(-0.5f, 1, -0.5f),
new Vector3f(+0.5f, 1, +0.5f), rgb, rgb, rgb));
triangles.add(new Triangle(new Vector3f(x, (float) map[x][z] * 100, z),
new Vector3f(-0.5f, 1, +0.5f),
new Vector3f(-0.5f, 1, -0.5f),
new Vector3f(+0.5f, 1, +0.5f), rgb, rgb, rgb));

start point XYZ coordinates, first triangle point "sub" coords, second triangle point "sub" coords, third triangle point "sub" coords, rgb for first point, rgb color for second point, rgb color for third point,

I cant do it... I think it is very easy and Im so stupid or so tired. Can you help me? ]]>

Math question here about finding theta between a line and a plane. I've gotten by the dot cross result for the top of the equation and am working the "magnitude" of each in the bottom part. Question: should I take the ABS of the two sqrt functions below? The tutorial showed the denominator initially having the abs symbol || but disappeared from the work up. Perhaps its assumed.

cos theta =

n dot a

------------------

sqrt(values...) sqrt(values)

Should the sqrt be | sqrt(values...)| |sqrt(values...)| ]]>

I wrote a function for that which uses

Code :

std::vector<Eigen::Vector3f> points; // input set of points
typedef Eigen::ParametrizedLine<float, 3> Line3;
static Line3 start_to_end = Line3::Through(points[0], points.back());
float max_dist_squared = 0.0f;
size_t max_idx = 0;
for (size_t i = 0; i<points.size(); ++i)
{
float dist2 = start_to_end.distance(points[i]);
if (dist2 > max_dist_squared)
{
max_dist_squared = dist2;
max_idx = i;
std::cout << "\n Distance is " << dist2 << " and i " << i << std::endl;
}
}

PROBLEM : I want to write same method using GLM. I mean to ask is any method that help me to find

i'm having problem to correctly animate separate nodes of a model. the nodes are hierarchically structured, and each node has a "mat4 Transform" (relative to its parent). to animate nodes, each nodes has an additional member "mat4 Animation" (relative to the base transform "mat4 Transform").

to get the final "mat4 world_transform":

Code cpp:

mat4 Node::WorldTransform() const
{
return
m_parent ?
inverse(inverse(Animation) * inverse(Transform) * inverse(m_parent->WorldTransform())) :
Transform * Animation;
}

in other words:

--> assimp gives me [Transform * Animation] and [Transform]

--> i want [Animation] only (separated)

how do i do that ??

http://assimp.sourceforge.net/lib_ht...ctai_node.html

http://assimp.sourceforge.net/lib_ht...node_anim.html

beside that:

is it better to pre-calculate all the possible animation matrices for each "key frame tick" or just do the calculations "on-the-fly" ? ]]>