use of org.cytoscape.math.xform.AxisRotation3D in project cytoscape-impl by cytoscape.
the class RotationLayouter method rotateGraph.
public void rotateGraph(double radians) {
if (m_translationToOrig == null)
return;
final AffineTransform3D xform = m_translationToOrig.concatenatePost((new AxisRotation3D(AxisRotation3D.Z_AXIS, radians)).concatenatePost(m_translationFromOrig));
for (CyNode node : m_graph.nodes()) {
if (!m_graph.isMovableNode(node))
continue;
m_pointBuff[0] = m_graph.getNodePosition(node, true);
m_pointBuff[1] = m_graph.getNodePosition(node, false);
m_pointBuff[2] = 0.0d;
xform.transformArr(m_pointBuff);
m_graph.setNodePosition(node, m_pointBuff[0], m_pointBuff[1]);
}
for (CyEdge edge : m_graph.edges()) {
if (!(m_graph.isMovableNode(edge.getSource()) && m_graph.isMovableNode(edge.getTarget())))
continue;
/* TODO support anchors
final int numAnchors = m_graph.getNumAnchors(edge);
for (int j = 0; j < numAnchors; j++) {
m_pointBuff[0] = m_graph.getAnchorPosition(edge, j, true);
m_pointBuff[1] = m_graph.getAnchorPosition(edge, j, false);
m_pointBuff[2] = 0.0d;
xform.transformArr(m_pointBuff);
m_graph.setAnchorPosition(edge, j, m_pointBuff[0], m_pointBuff[1]);
}
*/
}
}
Aggregations