本文整理汇总了C++中BezierCurve::getControlPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ BezierCurve::getControlPoint方法的具体用法?C++ BezierCurve::getControlPoint怎么用?C++ BezierCurve::getControlPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BezierCurve
的用法示例。
在下文中一共展示了BezierCurve::getControlPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
void CurveEditor::handleEvent(Event *event) {
if(mode == MODE_ADD) {
if(event->getDispatcher() == bg) {
if(event->getEventCode() == InputEvent::EVENT_MOUSEDOWN) {
InputEvent *inputEvent = (InputEvent*)event;
if(selectedCurve) {
Vector2 pos = inputEvent->mousePosition;
pos.x = pos.x/610.0;
pos.y = 1.0-(pos.y/254.0);
BezierCurve *targetCurve = selectedCurve->targetCurve;
bool done = false;
for(int i=0; i < targetCurve->getNumControlPoints(); i++) {
if(pos.x < targetCurve->getControlPoint(i)->p2.x && !done) {
targetCurve->insertPoint = targetCurve->getControlPoint(i);
done = true;
}
}
targetCurve->addControlPoint2dWithHandles(pos.x-0.1, pos.y, pos.x, pos.y, pos.x + 0.1, pos.y);
selectedCurve->updatePoints();
selectedCurve->updateCurve();
}
}
}
}
if(event->getDispatcher() == selectButton) {
selectorImage->setPosition(selectButton->getPosition().x - 4, selectButton->getPosition().y - 4);
setMode(0);
}
if(event->getDispatcher() == addButton) {
selectorImage->setPosition(addButton->getPosition().x - 4, addButton->getPosition().y - 4);
setMode(1);
}
if(event->getDispatcher() == removeButton) {
selectorImage->setPosition(removeButton->getPosition().x - 4, removeButton->getPosition().y - 4);
setMode(2);
}
if(event->getDispatcher() == treeContainer->getRootNode()) {
if(event->getEventCode() == UITreeEvent::SELECTED_EVENT) {
EditCurve *curve = (EditCurve *)treeContainer->getRootNode()->getSelectedNode()->getUserData();
if(selectedCurve) {
selectedCurve->Deactivate();
}
selectedCurve = curve;
if(curve) {
curve->Activate();
curve->setMode(mode);
}
}
}
UIWindow::handleEvent(event);
}
示例2: w_BezierCurve_getControlPoint
int w_BezierCurve_getControlPoint(lua_State *L)
{
BezierCurve *curve = luax_checkbeziercurve(L, 1);
int idx = (int) luaL_checknumber(L, 2);
if (idx > 0) // 1-indexing
idx--;
luax_catchexcept(L, [&]() {
Vector v = curve->getControlPoint(idx);
lua_pushnumber(L, v.x);
lua_pushnumber(L, v.y);
});
return 2;
}
示例3: drawBezierCurve
void ViewportPainter::drawBezierCurve(BezierCurve & curve) {
Point2D * beginPoint = curve.getBeginPoint();
Point2D * endPoint = curve.getEndPoint();
Point2D * controlPoint = curve.getControlPoint();
// Plus tard dessin de la courbe :
// this->drawArc(beginPoint->x(),beginPoint->y(),endPoint->x()-beginPoint->x(),endPoint->y()-beginPoint->y(),0*16,360*16);
this->drawLine(beginPoint->x(),beginPoint->y(),endPoint->x(),endPoint->y());
// Dessin du vecteur
/*this->setPen(QColor(255, 120, 0, 255));
this->drawPoint(*controlPoint);
this->drawLine(beginPoint->x(),beginPoint->y(),controlPoint->x(),controlPoint->y());
// Dessiner la fleche du vecteur
//this->drawLine(controlPoint->x(),controlPoint->y());
//this->drawLine(controlPoint->x(),controlPoint->y());
this->setPen(QColor(0, 0, 0, 255));*/
}