本文整理汇总了C++中Point2d::ComputeAngle方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2d::ComputeAngle方法的具体用法?C++ Point2d::ComputeAngle怎么用?C++ Point2d::ComputeAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2d
的用法示例。
在下文中一共展示了Point2d::ComputeAngle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryRemoveNodes
void Grapple::TryRemoveNodes()
{
std::list<rope_node_t>::reverse_iterator nodeit;
int lg;
Point2d V;
Point2i handPos, contact_point;
Double angle;
ActiveCharacter().GetHandPosition(handPos);
while (rope_nodes.size() > 1) {
nodeit = rope_nodes.rbegin();
++nodeit;
V.x = handPos.x - nodeit->pos.x;
V.y = handPos.y - nodeit->pos.y;
angle = V.ComputeAngle();
lg = static_cast<int>(V.Norm());
if (find_first_contact_point(nodeit->pos, angle, lg, SKIP_DST, contact_point))
break;
DetachNode();
}
}
示例2: TryAddNode
bool Grapple::TryAddNode()
{
uint lg;
Point2d V;
Point2i contact_point;
Double angle, rope_angle;
Point2i handPos;
ActiveCharacter().GetHandPosition(handPos);
// Compute distance between hands and rope fixation point.
V.x = handPos.x - m_fixation_point.x;
V.y = handPos.y - m_fixation_point.y;
angle = V.ComputeAngle();
lg = static_cast<int>(V.Norm());
if (lg < DST_MIN)
return false;
// Check if the rope collide something
if (find_first_contact_point(m_fixation_point, angle, lg, SKIP_DST, contact_point))
{
rope_angle = ActiveCharacter().GetRopeAngle() ;
// if contact point is the same as position of the last node
// (can happen because of jitter applied in find_first_contact_point),
// give up adding such node
if ( rope_nodes.size() > 0 && rope_nodes.back().pos == contact_point )
return false;
// The rope has collided something...
// Add a node on the rope and change the fixation point
AttachNode(contact_point, rope_angle);
return true;
}
return false;
}