Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 6b40201184
Fetching contributors…

Cannot retrieve contributors at this time

87 lines (73 sloc) 2.702 kB
This file is part of Tupi
Tupi is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Tupi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Tupi. If not, see <>.
#ifndef __LAYOUT_H__
#define __LAYOUT_H__
#include <Foundation/Foundation.h>
#include "Cell.h"
#include "ParticleBox.h"
#include "QuadTreeCellSpace.h"
#include "BarycenterCellData.h"
#include "Energy.h"
#include "TupiProtocols.h"
@protocol LayoutProtocol
- (long) numberOfMovedNodes;
- (double) stabilization;
- (double) stabilizationLimit;
- (int) quality;
- (void) setQuality: (int) q;
- (double) force;
- (void) setForce: (double) f; //[0..1]
- (void) freezeNode: (id<FDNode>) node frozen: (BOOL) fr;
- (void) removeNode: (id<FDNode>) node;
- (void) addNode: (id<FDNode>) node withName: (NSString *) nodeName;
- (void) addNode: (id<FDNode>) node withName: (NSString *) nodeName withLocation: (NSPoint) loc;
- (void) moveNode: (id<FDNode>) node toLocation: (NSPoint) loc;
- (void) list;
- (void) shake;
- (void) clear;
- (void) compute;
@class ParticleBox;
@class Cell;
@interface Layout : NSObject <LayoutProtocol>
ParticleBox *mainBox;
Energy *energy;
double k; // optimal distance between nodes.
double K1; // default attraction.
double K2; // default repulsion.
double force; // global force strength in [0..1] that is used to scale moves
double viewZone; // view distance at which the cells of the n-tree are explored exhaustively, after this the poles are used. This is a multiple of k.
double theta; //Barnes/Hut theta threshold to know if we use a pole or not.
int quality; // quality level.
int nodesPerCell; // number of nodes per space-cell.
int time; // Current step.
NSRect area;
double diagonalOfArea; // the diagonal of the graph area at the current step.
double maxMoveLength; // The maximum length of a node displacement at the current step.
double averageLength; // Average move length.
long numberOfMovedNodes;
double stabilizationLimit; // stabilisation limit of this algorithm.
NSConditionLock *lock;
- (NSArray *)allParticles;
- (NSRect) boundingBox;
- (Cell *)rootCell;
- (Energy*) energy;
Jump to Line
Something went wrong with that request. Please try again.