# Copyright (c) 1997-2007 # Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany) # http://www.math.tu-berlin.de/polymake, mailto:polymake@math.tu-berlin.de # # This program 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 2, or (at your option) any # later version: http://www.gnu.org/licenses/gpl.txt. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #----------------------------------------------------------------------------- # $Project: polymake $$Id: framework.rules 7568 2007-01-17 16:25:44Z gawrilow $ ######################################################################################### INCLUDE visual_framework.rules # A bar and joint framework is a graph with a given embedding. # author: Thilo Rörig object Framework # category: Framework properties # # A graph with a given embedding as node attribute. property FRAMEWORK $type="graph"; # category: Framework properties # # The graph of a framework property GRAPH $type="graph"; # category: Framework properties # # The embedding of the nodes of the framework (not in homogeneous coordinates). property EMBEDDING $type="matrix"; # category: Framework properties # # The number of nodes of the framework property N_NODES $type="cardinal"; # category: Framework properties # # The number of edges of the framework property N_EDGES $type="cardinal"; # category: Rigidity properties # # The number of degrees of freedom for the infinitesimal motions of a framework property N_DEGREES_OF_FREEDOM $type="cardinal"; # category: Framework properties # # The dimension of the embedding of the framework property DIM $type="cardinal"; # category: Rigidity properties # # The rigidity matrix of the framework property RIGIDITY_MATRIX $type="sparse_matrix"; # category: Rigidity properties # # This property is true if the framework does not allow any infinitesimal motion property INFINITESIMALLY_RIGID $type="boolean"; # category: Rigidity properties # # The rows of this matrix correspond to inifinitesimal motions of the framework. # The motion of the ith node is in columns [i*DIM, (i+1)*DIM - 1]. property INFINITESIMAL_MOTIONS $type="matrix"; # category: Rigidity properties # # Each row of the matrix corresponds to a row of @see INFINITESIMAL_MOTIONS and # contains its expansive pattern, i.e. each entry describes the behaviour of # an edge of the complete graph under the corresponding motion: # # If the entry is positive the edge expands, # if it is negative it shrinks, # if it is zero the length stays fixed. # # The order of the entries in each row correspond to the lexicographic # order of the edges of the complete graph on @see N_NODES nodes, i.e. (0 1), (0 2), ... , (0 N_NODES-1), # (1 2),...,(1 N_NODES-1), (N_NODES-2 N_NODES-1). property INFINITESIMAL_PATTERNS $type="matrix"; # category: Rigidity properties # # Each row of the matrix corresponds to a row of @see INFINITESIMAL_MOTIONS are the # sum of the coordinates of the @see EMBEDDING and the @see INFINITESIMAL_MOTIONS. property INFINITESIMAL_MOTION_COORDINATES $type="matrix"; # category: Rigidity properties # # The rigid components of the @see INFINITESIMAL_MOTIONS. property INFINITESIMAL_RIGID_COMPONENTS $type="array< powerset >"; # category: Rigidity properties # # The rows of this matrix correspond to expansive motions of the framework. # The motion of the ith node is in columns [i*DIM, (i+1)*DIM - 1]. property EXPANSIVE_MOTIONS $type="matrix"; # category: Rigidity properties # # The patterns of the @see EXPANSIVE_MOTIONS. The notation is similar to @see INFINITESIMAL_PATTERNS. property EXPANSIVE_PATTERNS $type="matrix"; # category: Rigidity properties # # Each row of the matrix corresponds to a row of @see EXPANSIVE_MOTIONS are the # sum of the coordinates of the @see EMBEDDING and the @see EXPANSIVE_MOTIONS. property EXPANSIVE_MOTION_COORDINATES $type="matrix"; # category: Rigidity properties # # An inequality description of the cone of @see EXPANSIVE_MOTIONS. property EXPANSIVE_MOTION_CONE $type="matrix"; # category: Rigidity properties # # The rigid components of the @see EXPANSIVE_MOTIONS. property EXPANSIVE_RIGID_COMPONENTS $type="array< powerset >"; ################################################################################ # category: Framework properties # # labels of the nodes of the framework property NODE_LABELS $type="list"; #rules N_NODES : FRAMEWORK $this->N_NODES = scalar(@{$this->FRAMEWORK}); N_EDGES : GRAPH WEIGHT 1.10 my $edges=0; foreach (row_sizes($this->GRAPH)) { $edges+=$_ } if ($edges % 2 == 0) { $edges /= 2; } else { die "GRAPH contains an edge which is not matched\n"; } $this->N_EDGES=$edges; RIGIDITY_MATRIX, INFINITESIMALLY_RIGID, DIM : FRAMEWORK WEIGHT 2.10 client("rigidity_matrix",$this); INFINITESIMAL_MOTIONS, INFINITESIMAL_MOTION_COORDINATES, INFINITESIMAL_PATTERNS, N_DEGREES_OF_FREEDOM : FRAMEWORK, RIGIDITY_MATRIX WEIGHT 2.10 client("infinitesimal_motions",$this); EXPANSIVE_MOTIONS, EXPANSIVE_MOTION_COORDINATES, EXPANSIVE_PATTERNS, EXPANSIVE_MOTION_CONE : FRAMEWORK, INFINITESIMAL_MOTIONS client("expansive_motions",$this); EXPANSIVE_RIGID_COMPONENTS : EXPANSIVE_PATTERNS, FRAMEWORK client("rigid_components_of_patterns", $this, "EXPANSIVE_RIGID_COMPONENTS", "EXPANSIVE_PATTERNS"); INFINITESIMAL_RIGID_COMPONENTS : INFINITESIMAL_PATTERNS, FRAMEWORK client("rigid_components_of_patterns", $this, "INFINITESIMAL_RIGID_COMPONENTS", "INFINITESIMAL_PATTERNS"); DIM : EMBEDDING $this->DIM = dim($this->EMBEDDING); DIM : FRAMEWORK WEIGHT 0.10 my $point = ${$this->FRAMEWORK}[0]; $point =~ s/^\(<(.*)>.*$/$1/; $this->DIM = scalar(split(/\s+/,$point)); EMBEDDING : FRAMEWORK my @embedding = @{$this->FRAMEWORK}; map { s/^\(\<(.*)\>.*\)$/$1/ } @embedding; $this->EMBEDDING = \@embedding; GRAPH, EMBEDDING : FRAMEWORK my $i = 0; my (@graph,@embedding); map { /^\(\<(.*)\>\s*(\{.*\})\s*\)$/; $embedding[$i] = "$1\n"; $graph[$i++] = "$2\n"; } @{$this->FRAMEWORK}; $this->GRAPH = \@graph; $this->EMBEDDING = \@embedding; 1; # Local Variables: # mode: perl # c-basic-offset:3 # End: