示例#1
0
    private void UpdateLayout(GraphSceneComponents sceneComponents, float time)
    {
        float sphRadius             = GraphRenderer.Singleton.nodePhysXForceSphereRadius;
        float sphRadiusSqr          = sphRadius * sphRadius;
        float intendedLinkLengthSqr = GraphRenderer.Singleton.linkIntendedLinkLength * GraphRenderer.Singleton.linkIntendedLinkLength;
        bool  repulseActive         = GraphRenderer.Singleton.RepulseActive;

        foreach (var n in sceneComponents.nodeComponents)
        {
            doGravity(n.Rb);
            if (repulseActive)
            {
                doRepulse(n.Rb, n.aoundColliders, sphRadiusSqr);
            }
        }

        foreach (var e in sceneComponents.edgeComponents)
        {
            doAttraction(e.sourceRb, e.targetRb, intendedLinkLengthSqr);
        }
    }
示例#2
0
 public ForceDirectedGraphLayout(GraphSceneComponents sceneComponents)
 {
     this.sceneComponents = sceneComponents;
 }
 public AbstractGraphLayout(GraphSceneComponents sceneComponents)
 {
     this.sceneComponents = sceneComponents;
 }
 protected abstract void UpdateGraphLayout(GraphSceneComponents sceneComponents, float time);