1 /* === S I N F G =========================================================== */
2 /*! \file valuenode_segcalcvertex.cpp
3 ** \brief Template File
5 ** $Id: valuenode_segcalcvertex.cpp,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
31 #include "valuenode_segcalcvertex.h"
32 #include "valuenode_const.h"
33 #include "valuenode_composite.h"
35 #include "exception.h"
36 #include <ETL/hermite>
41 /* === U S I N G =========================================================== */
45 using namespace sinfg;
47 /* === M A C R O S ========================================================= */
49 /* === G L O B A L S ======================================================= */
51 /* === P R O C E D U R E S ================================================= */
53 /* === M E T H O D S ======================================================= */
55 ValueNode_SegCalcVertex::ValueNode_SegCalcVertex(const ValueBase::Type &x):
58 if(x!=ValueBase::TYPE_VECTOR)
59 throw Exception::BadType(ValueBase::type_name(x));
61 segment_=ValueNode_Composite::create(ValueBase::TYPE_SEGMENT);
62 amount_=ValueNode_Const::create(Real(0.5));
66 ValueNode_SegCalcVertex*
67 ValueNode_SegCalcVertex::create(const ValueBase &x)
69 return new ValueNode_SegCalcVertex(x.get_type());
72 ValueNode_SegCalcVertex::~ValueNode_SegCalcVertex()
78 ValueNode_SegCalcVertex::operator()(Time t)const
80 Segment segment((*segment_)(t).get(Segment()));
82 etl::hermite<Vector> curve(segment.p1,segment.p2,segment.t1,segment.t2);
84 return curve((*amount_)(t).get(Real()));
89 ValueNode_SegCalcVertex::get_name()const
91 return "segcalcvertex";
95 ValueNode_SegCalcVertex::get_local_name()const
97 return _("SegCalcVertex");
101 ValueNode_SegCalcVertex::check_type(ValueBase::Type type)
103 return type==ValueBase::TYPE_VECTOR;
107 ValueNode_SegCalcVertex::set_link_vfunc(int i,ValueNode::Handle x)
109 assert(i==0 || i==1);
113 signal_child_changed()(i);signal_value_changed()();
119 signal_child_changed()(i);signal_value_changed()();
125 ValueNode::LooseHandle
126 ValueNode_SegCalcVertex::get_link_vfunc(int i)const
128 assert(i==0 || i==1);
138 ValueNode_SegCalcVertex::link_count()const
144 ValueNode_SegCalcVertex::link_name(int i)const
146 assert(i==0 || i==1);
155 ValueNode_SegCalcVertex::link_local_name(int i)const
157 assert(i==0 || i==1);
166 ValueNode_SegCalcVertex::get_link_index_from_name(const String &name)const
173 throw Exception::BadLinkName(name);
177 ValueNode_SegCalcVertex::create_new()const
179 return new ValueNode_SegCalcVertex(ValueBase::TYPE_VECTOR);