Click here to Skip to main content
15,884,893 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am trying to decal sketch on mesh using exponential map. While generating exponential map, I am calculating plane by initial point on mesh and normal calculated on mesh by that point. then algorithm calculates nearest vertices from that point and traverse to them by edges.

Then Edges are projected on plan with their original lengths. It works in most cases, But there is problems in case of sphere. the map is getting twisted.

Do I need to do anything different for the spheres? Any ideas on how this issue can be resolved? Or has anybody done something similar using a different algorithm for exponential map?

I have created below code

while (i < lstVerts.size())
{
CVertex *pVertex = mesh.getVertexAt(lstVerts[i]);
pVertex->m_iExpPos = i;

if (pVertex->m_iNeighbour > -1)
{
CVector vecPoint = pVertex->toVector() - pVertex->Neighbour()->toVector();
double len = vecPoint.norm();
CVector tmp = (pVertex->Neighbour()->normal() * -1) * vecPoint;
vec = tmp * sketch.m_meshNorm;
vec.unitize();
vec = vec * len;

double u = vec.dot(sketch.m_meshX);
pVertex->m_u = u + pVertex->Neighbour()->m_u;
double v = vec.dot(yDir);
pVertex->m_v = v + pVertex->Neighbour()->m_v;
}
else
{
vec = pVertex->toVector() - pnt;
pVertex->m_u = vec.dot(sketch.m_meshX);
pVertex->m_v = vec.dot(yDir);
pVertex->m_Propogation = vec;
}

AddAdjacentUnvisitedVertices(pVertex, lstVerts);
}

pnt is one point where exponential map will start. Initially, lstVerts will contain vertices near to pnt. Gradually it will add adjacent vertices.

I think problem is algo uses edge length as it is in exponential map. I think it need to be adjusted. I don't know how?

To know about Exponential Map and Algorithm that i have used, please refer below links

http://www.diva-portal.org/smash/get/diva2:331960/FULLTEXT01.pdf

http://www1.cse.wustl.edu/~cmg/content/papers/sig2006tm/sig2006tm.pdf
Posted
Updated 18-Mar-15 3:36am
v5
Comments
RedDk 13-Mar-15 15:21pm    
What are the "specifics" in this quest? I see C++, Visual Studio, and AutoCAD. Have you used the debugger? Perhaps pick a method (AutoCAD) and set a break-point ... What error is generated if you insert some nonsense somewhere?

QA works best when you've shown some code. But, having hung out in this forum and become familiar with tagging, even THIS topic won't yeild much:

http://www.codeproject.com/script/Answers/List.aspx?tags=78,1039&alltags=true
KarstenK 14-Mar-15 4:39am    
write some test szenario data which you really understand and verify all parts of your code. Or wait til you time runs out...
[no name] 16-Mar-15 0:34am    
The problem is that all the people who can answer this question will need to run the code in your debugger. At the moment there is only one person in the entire universe who can do that.
RedDk 18-Mar-15 21:13pm    
Ok,

I see your new links; thanks for those.

Run this in your browser. Perhaps along these lines some more study?

http://www.codeproject.com/search.aspx?q=projecting+2D+on+3D+objects&sbo=kw&usfc=false

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900