: m_ElectricalRepulsion(100.0f)
64, m_RepulsionDist(350.0f)
65, m_VelocityThresholdK(0.002f)
77 #ifdef ATTRIB_MENU_SUPPORT 92sub_menu->
AddFloat(
"Vel Threshold K",
110 #ifdef ATTRIB_MENU_SUPPORT 130 #ifdef VALIDATE_NODE_NODE_FORCES 156std::vector<Edge>::iterator eiter;
166std::vector<int>& neighbor_nodes =
m_NodeGrid.
Get(adjacent_idx);
169 for(
size_t i=0;
i<cell_nodes.size(); ++
i) {
170 for(
size_tj=0; j<neighbor_nodes.size(); ++j) {
171 intidx1 = cell_nodes[
i];
172 intidx2 = neighbor_nodes[j];
176 floatdist2 =
offset.Length2();
178 if(dist2 < m_RepulsionDist2 && dist2 >
FLT_EPSILON) {
181 floatdist = sqrtf(dist2);
188 #ifdef NUMERIC_ERROR_CHECK 200 #ifdef VALIDATE_NODE_NODE_FORCES 224 for(
intx = min_pos.
X(); x <= max_pos.
X(); ++x) {
225 for(
inty = min_pos.
Y(); y <= max_pos.
Y(); ++y) {
228 if(cell_nodes.size() > 0) {
230 for(
size_t i=0;
i<cell_nodes.size(); ++
i) {
231 for(
size_tj=
i+1; j<cell_nodes.size(); ++j) {
233 intidx1 = cell_nodes[
i];
234 intidx2 = cell_nodes[j];
238 floatdist2 =
offset.Length2();
241 if(dist2 < m_RepulsionDist2 && dist2 >
FLT_EPSILON) {
242 floatdist = sqrtf(dist2);
249 #ifdef NUMERIC_ERROR_CHECK 262 #ifdef VALIDATE_NODE_NODE_FORCES 279x_ApplyNeighborCellForces(cell_nodes, CVect2<int>(x+1,y));
281if (y+1 < m_NodeGrid.GetHeight())
282x_ApplyNeighborCellForces(cell_nodes, CVect2<int>(x+1,y+1));
286x_ApplyNeighborCellForces(cell_nodes, CVect2<int>(x,y+1));
289x_ApplyNeighborCellForces(cell_nodes, CVect2<int>(x-1,y+1));
302 for(
size_t i=0;
i<
m_Nodes.size(); ++
i) {
303 for(
size_tj=
i+1; j<
m_Nodes.size(); ++j) {
306 floatdist2 =
offset.Length2();
313 #ifdef NUMERIC_ERROR_CHECK 324 #ifdef VALIDATE_NODE_NODE_FORCES 335 #ifdef VALIDATE_NODE_NODE_FORCES 347std::vector<Edge>::iterator eiter;
363 floatdist =
offset.Length();
367 floatldist = logf(dist*(*eiter).rest_len_inv);
375#ifdef NUMERIC_ERROR_CHECK
392 #ifdef VALIDATE_NODE_NODE_FORCES 393std::vector<Node>::iterator niter1, niter2;
394 for(niter1=
m_Nodes.begin(); niter1!=
m_Nodes.end(); ++niter1) {
395 TVecp1 = (*niter1).pos;
397 for(niter2=niter1+1; niter2!=
m_Nodes.end(); ++niter2) {
398 TVecp2 = (*niter2).pos;
403 floatdist2 =
offset.Length2();
405 intidx1 = niter1-
m_Nodes.begin();
406 intidx2 = niter2-
m_Nodes.begin();
470std::vector<Node>::iterator niter;
473 TVecprev_offset((*niter).pos - (*niter).prev_pos);
474(*niter).prev_pos = (*niter).pos;
477(*niter).accel.X()*step)*(*niter).constrained;
479(*niter).accel.Y()*step)*(*niter).constrained;
481#ifdef NUMERIC_ERROR_CHECK
483 _TRACE(
"Bad float! "<< (*niter).pos.X() <<
" "<< (*niter).pos.Y());
516 floatmax_velocity_squared = 0.0f;
526std::vector<Node>::iterator niter;
529 TVecprev_offset((*niter).pos - (*niter).prev_pos);
530(*niter).prev_pos = (*niter).pos;
533(*niter).accel.X()*step)*(*niter).constrained;
535(*niter).accel.Y()*step)*(*niter).constrained;
537max_velocity_squared =
std::max(max_velocity_squared, xoff*xoff + yoff*yoff);
539(*niter).pos.X() += xoff;
540(*niter).pos.Y() += yoff;
549(*m_Tree)[(*niter).tree_node_idx]->XY() = (*niter).pos;
559(*m_Tree)[(*niter).tree_node_idx]->SetAngle(
560((*niter).pos.X()-ppos.
X() >= 0.0f) ? 0.0f : 3.1415927f);
572 floatnode_count = (float)
m_Nodes.size();
574threshold =
std::min(10.0f, threshold);
593std::vector<Edge>::iterator eiter;
604 floatdist =
offset.Length();
605 floatldist = logf(dist*(*eiter).rest_len_inv);
620glColor3f(1.0f, 1.0f, 0.0f);
622std::vector<Node>::iterator niter;
645 #ifdef VALIDATE_NODE_NODE_FORCES 668 for(
size_tj=0; j<
m_Nodes.size(); ++j) {
694 n.pos = tnode->XY();
695 n.prev_pos =
n.pos;
697 n.constrained = 1.0f;
698 n.tree_node_idx = node_idx;
715 n.constrained = 1.0f;
718 float len= (
n.pos-ppos).Length();
729 else if(
delta== -1) {
CInitPSNodes(CPhyloTreePS *ps)
CPhyloTree::TTreeIdx TTreeIdx
ETreeTraverseCode operator()(CPhyloTree &tree, TTreeIdx node_idx, int delta)
float m_RepulsionDist2
Square of current effective repulsion distance.
float m_RepulsionInv_x_ElectricalRepulsion
Inverse of repulsion dist * electrical repulsion factor.
void Init(CPhyloTreeDataSource &ds)
void x_ApplyNeighborCellForces(std::vector< int > &cell_nodes, const CVect2< int > &adjacent_idx)
Called compute forces between nodes in 2 cells.
PhysicsParms m_PhysicsParmsSafe
Updated from m_PhysicsPamsVolatile when safe to do so.
float m_MaxVelocity
The maximum velocity is the maximum node velocity during the last call to UpdateAndSynch()
float m_edge_forces_t
For timer values.
float m_bound_update_safe_t
PhysicsParms m_PhysicsParmsVolatile
(potentially) updated from other thread(s)
int m_node_node_interactions_safe_t
std::vector< CVect2< int > > m_ValidateGrid
Only used for debugging.
float m_edge_forces_safe_t
bool m_IsDone
If true, system has slowed down to the point where continuing to update it is not necessary.
void x_Init(CPhyloTree *tree)
Create particle system from tree - ignore collapsed.
void x_ApplyRepulsiveForces()
Apply repulsive forces between all nodes.
std::vector< Node > m_Nodes
Set of all nodes.
float m_DefaultEdgeLen
Default length for all edges in system.
TVec & GetMinPos()
Tracks bounding rectangle for all nodes.
float m_AdaptiveStep
Multiplier for m_PhysicsParmsSafe.m_Step to allow step size to be adaptively lowered if system appear...
float m_node_forces_safe_t
void Draw()
Visualize graph - debug rendering.
TVec m_MinPos
Tracks bounding rectangle for all nodes.
float m_LogDistMax
For debug-drawing.
std::vector< Edge > m_Edges
Set of all edges.
void x_UpdateVoxels()
Update spatial subdivision of nodes.
int m_node_node_interactions_t
void x_ApplyRepulsiveForcesHashed()
Apply forces between nodes based on defined neighborhood size.
float & GetDefaultEdgeLen()
Default length for all edges in system.
std::vector< Node > & GetNodes()
Set of all nodes.
std::vector< Edge > & GetEdges()
Set of all edges.
void UpdateAndSynch()
Calculate forces, update positions, and update underlying tree.
void Update()
Calculate force then update positions.
float m_PrevMaxVelocity
Maximum velocity in previous update.
CSpatialHash2D< std::vector< int > > m_NodeGrid
Grid that keeps track of adjacent nodes.
CPhyloTree * m_Tree
Root node of tree.
void CalcForces()
Calculate forces for all nodes.
std::vector< CVect2< int > > m_ValidateNsq
Tree subclass also has functions and data needed for rendering and selection.
const TVeci & GetMin()
Get min/max indices for current (whole) grid.
TElemType & Get(const TVeci &item)
int GetWidth() const
Get width/height of grid.
bool HasParent() const
Check if the node has a parent.
bool IsLeaf() const
Report whether this is a leaf node.
static TTreeIdx Null()
Return the index value that represents a NULL node.
const T * GetData() const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Stop(void)
Suspend the timer.
void Start(void)
Start the timer.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
@ eTreeTraverse
Keep traversal.
unsigned int
A callback function used to compare two keys in a database.
if(yy_accept[yy_current_state])
The NCBI C++/STL use hints.
Defines: CTimeFormat - storage class for time format.
Int4 delta(size_t dimension_, const Int4 *score_)
void TreeDepthFirstEx(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
Depth-first tree traversal that skips collapsed nodes.
Data structure for an edge between two nodes.
Data structure for a node in the particle system.
float m_VelocityThresholdK
factor to scale final velocity threshold
float m_ElectricalRepulsion
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4