本文整理汇总了C++中Bezier::SetFromCorners方法的典型用法代码示例。如果您正苦于以下问题:C++ Bezier::SetFromCorners方法的具体用法?C++ Bezier::SetFromCorners怎么用?C++ Bezier::SetFromCorners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bezier
的用法示例。
在下文中一共展示了Bezier::SetFromCorners方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TrimPatch
///trim the patch's width in-place
void AiCarStandard::TrimPatch(Bezier & patch, float trimleft_front, float trimright_front, float trimleft_back, float trimright_back)
{
Vec3 frontvector = (patch.GetPoint(0,3) - patch.GetPoint(0,0));
Vec3 backvector = (patch.GetPoint(3,3) - patch.GetPoint(3,0));
float frontwidth = frontvector.Magnitude();
float backwidth = backvector.Magnitude();
if (trimleft_front + trimright_front > frontwidth)
{
float scale = frontwidth/(trimleft_front + trimright_front);
trimleft_front *= scale;
trimright_front *= scale;
}
if (trimleft_back + trimright_back > backwidth)
{
float scale = backwidth/(trimleft_back + trimright_back);
trimleft_back *= scale;
trimright_back *= scale;
}
Vec3 newfl = patch.GetPoint(0,0);
Vec3 newfr = patch.GetPoint(0,3);
Vec3 newbl = patch.GetPoint(3,0);
Vec3 newbr = patch.GetPoint(3,3);
if (frontvector.Magnitude() > 0.001)
{
Vec3 trimdirection_front = frontvector.Normalize();
newfl = patch.GetPoint(0,0) + trimdirection_front*trimleft_front;
newfr = patch.GetPoint(0,3) - trimdirection_front*trimright_front;
}
if (backvector.Magnitude() > 0.001)
{
Vec3 trimdirection_back = backvector.Normalize();
newbl = patch.GetPoint(3,0) + trimdirection_back*trimleft_back;
newbr = patch.GetPoint(3,3) - trimdirection_back*trimright_back;
}
patch.SetFromCorners(newfl, newfr, newbl, newbr);
}