SetEdgeStrengthDelta.cpp

Go to the documentation of this file.
00001 
00005 /* Copyright © 2009 James Legg.
00006     This program is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 */
00011 
00012 #include "SetEdgeStrengthDelta.h"
00013 #include "../Track.h"
00014 
00015 namespace Document
00016 {
00017 
00018 EdgeStrengthFinder::EdgeStrengthFinder(std::size_t edge_index, EdgeEndEnum end)
00019     :   edge_index(edge_index)
00020     ,   end(end)
00021 {
00022 }
00023 
00024 void EdgeStrengthFinder::read(const Track::Track & track, btScalar & strength)
00025 {
00026     const Track::PathEdge & edge = track.get_path().get_edge(edge_index);
00027     const Track::PathEdgeEnd & edge_end = end == Track::EditAssist::EdgeStrengthHandle::EE_SOURCE ? edge.start : edge.finish;
00028     strength = edge_end.gradient_strength;
00029 }
00030 
00031 void EdgeStrengthFinder::write(Track::Track & track, const btScalar & new_strength)
00032 {
00033     Track::Path & path = track.get_path();
00034     Track::Path::Graph::edge_descriptor edge_descriptor = path.get_edge_descriptor(edge_index);
00035     Track::PathEdge & edge = path.graph[edge_descriptor];
00036     Track::PathEdgeEnd & edge_end = end == Track::EditAssist::EdgeStrengthHandle::EE_SOURCE ? edge.start : edge.finish;
00037     edge_end.gradient_strength = new_strength;
00038     edge.update();
00039 }
00040 
00041 }

Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:11 2010 by Doxygen version 1.4.7 for Racer version svn335.