algorithmic modeling for Rhino
Hi everyone,
I have finally found some time to try and develop some custom goals for Kangaroo, and I would like to ask if I am going down the right direction, because when I am using the goal I made it doesnt seem to do much. It is supposed to be an inflate component with a cotangent based weighting scheme.
I have attached a GH doc with the inputs internalised. It is from the Rhino WIP and uses the spatial slur library to calculate weights pr node. if you want that library please visit: http://spatialslur.com/code/
Any help is much appreciated.
Tags:
Hi petras,
Do you mean internalise or initialize? because the geometry should be internalised.
Eitherway I have attached a rhino and gh file to this message, Thank you
Hi Petras,
I figured out what was wrong. I had made a simple mistake. Thereby saying that it works the way I wanted it too, but it is doing something, hehe.
Thank you for your time. I will repost once I am done.
Hi Jens,
The key problem I see here is that you use the PPos array to build your mesh at each iteration.
PPos is the initial positions of the particles. It is only used in the initialization.
To get the positions of the particles at the current iteration you can call:
this.GetCurrentPositions(p)
which will return an array of Point3d
Aside from that, some other general comments on the code:
Building a halfedge mesh every time is a lot of work to simply get the neighbours around each vertex. This is easy to get from a Rhino mesh.
There is also some strange conversion to degrees in there - no need for this, as the default math operators work with radians.
You could also write a per triangle goal (acting on only 3 points) to get the same result in a simpler way, by modifying the existing pressure goal so that instead of splitting the force over the 3 vertices evenly, it divides it according to Voronoi area (which is what the cotan weighting achieves).
Hope that helps. Let me know if you have more questions.
Hi Daniel,
Thank you for the reply.
Since I posted this I was informed by Delueran that you have listed all the components on your github which proved to be immensely helpfull :)
However I didnt stuble on the current position method, but I will definitely start to implement that now.
Thank you for the pointers, they are much appreciated. Regarding the HEmesh, when I code something the first time I often try and do too much and therefore end up overcomplicating things. But the conversion to degrees is necesary because I am using cotangents(1/tan(x)) which needs degrees and not radians, or that is at least what I could figure out yesterday.
Anyway, I now have a simple case working and will start to weight the vertex normals by vertex area/mass. I will upload something once I have written it:)
Glad to help.
There's no need to use degrees at all - Math.Tan and Vector3d.VectorAngle both use radians, as does the formula for Voronoi area.
You might find this handy:
https://www.cs.cmu.edu/~kmcrane/Projects/Other/TriangleAreasCheatSh...
(you are effectively summing W for all triangles around a vertex)
In fact - since these are relative weights the scalar multiplier doesn't matter here, but why do unnecessary computation!
That cheat sheet is immensely handy!
Glad to know theres no need to use the RhinoMAth function, never really been a fan. So no more degree conversion on my end.
I dont fully understand your last statement, are you refereing to the W as the scalar multiplier? or what I was doing?
Hey Jens,
As Daniel was saying, rebuilding the halfedge mesh every iteration will be pretty costly. Instead, the goal could just hold a single HeMesh instance and update its vertex positions with the corresponding particle positions at the beginning of Calculate().
Also, if your weights are the vertex dual areas and your move vectors are vertex normals, you can get both from methods of HeVertexList. With that, Calculate() can be simplified to the following.
void Calculate(List particles){
// update HeMesh vertex positions with particle positions
// ...
// calculate weights and move vectors
_mesh.Vertices.GetVertexAreasTri(Weighting);
_mesh.Vertices.GetVertexNormals(Move);
}
Cheers, buddy :)
I was planing on asking you if it was possible to reassign the verticies in your slurmesh, as simply as
heM.Vertices = PPos.CurrentPosition(I know this isnt a function):)
Anyway I have simplified what I am doing and is calculating vertex areas based on a pr face basis based on a Rhino Mesh. Which seems to do a decent job. Should be able to post some stuff tomorrow :)
Hi Guys,
Thank you for all your help. I have attached a simple version of what I am doing where the inflation is controlled by a field pr verticy. I also have one where I have the area weights, I simply need to factor them correctly for it too work properly. But if it has any interest I have attached the simple version to this message. It only uses Kangaroo and no HE
Added by UTB01 0 Comments 0 Likes
Added by David Bachman 0 Comments 0 Likes
© 2017 Created by Scott Davidson. Powered by