affine_combo<Angle,float> ang_combo;
Real mag(mag_combo(a.mag(),b.mag(),c));
- Angle ang(ang_combo(Angle::tan(a[1],a[0]),Angle::tan(b[1],b[0]),c));
+ Angle angle_a(Angle::tan(a[1],a[0]));
+ Angle angle_b(Angle::tan(b[1],b[0]));
+ float diff = Angle::deg(angle_b - angle_a).get();
+ if (diff < -180) angle_b += Angle::deg(360);
+ else if (diff > 180) angle_a += Angle::deg(360);
+ Angle ang(ang_combo(angle_a, angle_b, c));
return Point( mag*Angle::cos(ang).get(),mag*Angle::sin(ang).get() );
}
{
closest = d;
best_time = time;
- best_index = i;
+ best_index = 0;
best_point = curve(best_time);
}
}
Real amount = (best_index + best_time + loop_adjust) / (size + loop_adjust);
return amount;
}
-
+
return 0.0;
}
return ret;
}
+static int instance_count;
+
ValueBase
ValueNode_BLine::operator()(Time t)const
{
+ if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
+ printf("%s:%d operator()\n", __FILE__, __LINE__);
+
std::vector<BLinePoint> ret_list;
std::vector<ListEntry>::const_iterator iter,first_iter;
return etl::strprintf(_("Vertex %03d"),i+1);
}
-ValueNode*
-ValueNode_BLine::clone(const GUID& deriv_guid)const
-{
- { ValueNode* x(find_value_node(get_guid()^deriv_guid).get()); if(x)return x; }
-
- ValueNode_BLine* ret=new ValueNode_BLine();
- ret->set_guid(get_guid()^deriv_guid);
-
- std::vector<ListEntry>::const_iterator iter;
-
- for(iter=list.begin();iter!=list.end();++iter)
- {
- if(iter->value_node->is_exported())
- ret->add(*iter);
- else
- {
- ListEntry list_entry(*iter);
- //list_entry.value_node=find_value_node(iter->value_node->get_guid()^deriv_guid).get();
- //if(!list_entry.value_node)
- list_entry.value_node=iter->value_node->clone(deriv_guid);
- ret->add(list_entry);
- //ret->list.back().value_node=iter->value_node.clone();
- }
- }
- ret->set_loop(get_loop());
-
- return ret;
-}
-
String
ValueNode_BLine::get_name()const
{
LinkableValueNode*
ValueNode_BLine::create_new()const
{
- assert(0);
- return 0;
+ return new ValueNode_BLine();
}
bool