本文整理汇总了C++中Bezier::Evaluate方法的典型用法代码示例。如果您正苦于以下问题:C++ Bezier::Evaluate方法的具体用法?C++ Bezier::Evaluate怎么用?C++ Bezier::Evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bezier
的用法示例。
在下文中一共展示了Bezier::Evaluate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VUpdate
void VUpdate(double milliseconds) override
{
auto input = &Input::SharedInstance();
vec4f point;
vec3f position(0.0f, 0.0f, 0.0f);
mCircleScale.x = 30.0f / mOptions.mWindowWidth;
mCircleScale.y = 30.0f / mOptions.mWindowHeight;
mCircleScale.z = 1.0f;
auto mousePos = ScreenToWorldPosition(input->mousePosition);
static auto pIndex = -1;
if (input->GetMouseButtonDown(MOUSEBUTTON_LEFT))
{
auto minDist = 10000.0f;
auto minIndex = -1;
for (size_t i = 0; i < 4; i++)
{
auto p = vec3f(mBezier.p[i].x, mBezier.p[i].y, 0);
auto dist = min(minDist, (mousePos - p).magnitude2());
if (dist < minDist)
{
minDist = dist;
minIndex = i;
}
}
if (minDist < .025f)
{
pIndex = minIndex;
}
} else if (input->GetMouseButtonUp(MOUSEBUTTON_LEFT))
{
pIndex = -1;
}
if (pIndex > -1)
{
mBezier.p[pIndex].x = mousePos.x;
mBezier.p[pIndex].y = mousePos.y;
}
for (size_t i = 0; i < 4; i++)
{
mHandlesVertices[i].mPosition.x = mBezier.p[i].x;
mHandlesVertices[i].mPosition.y = mBezier.p[i].y;
}
float t;
for (size_t i = 0, j = 0; i < BEZIER_VERTEX_COUNT; i++, j += 2)
{
t = static_cast<float>(i) / (BEZIER_VERTEX_COUNT - 1);
mBezier.EvaluateSIMD(t, &point);
mBezier.Evaluate(t, &point);
mBezierVertices[i].mPosition = { point.x, point.y, point.z };
}
mMatrixBuffer.mWorld = mat4f::translate(position).transpose();
}