本文整理汇总了C++中getStartPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ getStartPoint函数的具体用法?C++ getStartPoint怎么用?C++ getStartPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getStartPoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getStartPoint
Point2d MgArc::_getHandlePoint(int index) const
{
if (index == 1) {
return getStartPoint();
}
if (index == 2) {
return getEndPoint();
}
if (index == 3) {
return getMidPoint();
}
if (index == 4) {
return (getStartPoint() * 2 + getCenter()) / 3;
}
if (index == 5) {
return (getEndPoint() * 2 + getCenter()) / 3;
}
if (index == 6) {
return getStartPoint() + getStartTangent();
}
if (index == 7) {
return getEndPoint() + getEndTangent();
}
return getCenter();
}
示例2: getParamTo
void REllipse::moveStartPoint(const RVector& pos, bool changeAngleOnly) {
if (changeAngleOnly) {
startParam = getParamTo(pos);
}
else {
RVector ep = getEndPoint();
double distOri = ep.getDistanceTo(getStartPoint());
double angleOri = ep.getAngleTo(getStartPoint());
if (distOri<RS::PointTolerance) {
return;
}
double distNew = ep.getDistanceTo(pos);
double angleNew = ep.getAngleTo(pos);
double factor = distNew / distOri;
if (factor<RS::PointTolerance) {
return;
}
double angleDelta = angleNew - angleOri;
center.scale(factor, ep);
center.rotate(angleDelta, ep);
majorPoint.scale(factor);
majorPoint.rotate(angleDelta);
}
}
示例3: obtainCurvePath
QPainterPath CurveGraphicsItem::obtainCurvePath() const {
if (useMidPoint_) {
return obtainCurvePath(getStartPoint(), getMidPoint()) +
obtainCurvePath(getMidPoint(), getEndPoint());
} else {
return obtainCurvePath(getStartPoint(), getEndPoint());
}
}
示例4: T3dBoundedLine_base
C3dBoundedLine::C3dBoundedLine(const C3dWorldPoint & p1, const C3dWorldPoint & p2) : T3dBoundedLine_base(p1, p2)
{
if(IS_DEBUG)
{
p1.checkInit();
p2.checkInit();
CHECK(getStartPoint() == getFinishPoint() && getStartPoint() != C3dWorldPoint::uninit(), "Line end points are equal");
}
}
示例5: getControlItemPosFirst
QPainterPath ArrowLinkItem::originalShape() const
{
QPointF c1 = getControlItemPosFirst();
QPointF c2 = getControlItemPosSecond();
QPainterPath path(getStartPoint());
path.cubicTo(c1, c2, getEndPoint());
path.cubicTo(c2, c1, getStartPoint());
return path;
}
示例6: getCenter
float MgArc::getSweepAngle() const
{
if (!mgIsZero(_sweepAngle)) {
return _sweepAngle;
}
const float midAngle = (getMidPoint() - getCenter()).angle2();
const float startAngle = getStartAngle();
const float endAngle = getEndAngle();
if (mgEquals(midAngle, startAngle) && mgEquals(startAngle, endAngle)) {
return endAngle - startAngle;
}
Tol tol(getRadius() * 1e-3f, 1e-4f);
if (getStartPoint().isEqualTo(getEndPoint(), tol)
&& (getMidPoint() + (getStartPoint() + getEndPoint()) / 2).isEqualTo(2 * getCenter(), tol)) {
return _M_2PI;
}
float startAngle2 = startAngle;
float midAngle2 = midAngle;
float endAngle2 = endAngle;
// 先尝试看是否为逆时针方向:endAngle2 > midAngle2 > startAngle2 >= 0
if (startAngle2 < 0)
startAngle2 += _M_2PI;
while (midAngle2 < startAngle2)
midAngle2 += _M_2PI;
while (endAngle2 < midAngle2)
endAngle2 += _M_2PI;
if (fabsf(startAngle2 + endAngle2 - 2 * midAngle2) < _M_PI_6
&& endAngle2 - startAngle2 < _M_2PI) {
return endAngle2 - startAngle2;
}
// 再尝试看是否为顺时针方向:endAngle2 < midAngle2 < startAngle2 <= 0
startAngle2 = startAngle;
midAngle2 = midAngle;
endAngle2 = endAngle;
if (startAngle2 > 0)
startAngle2 -= _M_2PI;
while (midAngle2 > startAngle2)
midAngle2 -= _M_2PI;
while (endAngle2 > midAngle2)
endAngle2 -= _M_2PI;
if (fabsf(startAngle2 + endAngle2 - 2 * midAngle2) < _M_PI_6) {
if (endAngle2 - startAngle2 > -_M_2PI)
return endAngle2 - startAngle2;
return mgbase::toRange(endAngle2 - startAngle2, -_M_2PI, 0);
}
return endAngle - startAngle; // error
}
示例7: getStartDirection
void LaneLineTile::writeLine(std::ostream &out, double from, double to, double offset, double width, std::string color) const
{
if (from >= to)
return;
Vector2 orthogonal = getStartDirection().getPerpendicularVectorRight();
Vector2 p = getStartPoint() + getStartDirection() * from + orthogonal * offset;
Vector2 q = getStartPoint() + getStartDirection() * to + orthogonal * offset;
out << "<line x1=\"" << p[0] << "\" y1=\"" << p[1] << "\" x2=\"" << q[0] << "\" y2=\"" << q[1] << "\" style=\"stroke:" << color << "; stroke-width:" << width << ";\" />\n";
}
示例8: rightModifyPoint
bool RectangularRegion::hitRightModifyPoint(const QPoint &point) {
bool result = false;
QPoint rightModifyPoint(getStartPoint().x() + getWidth(), getStartPoint().y() + getHeight() / 2);
if (Region::distance(point, rightModifyPoint) <= SQUARE(MODIFY_POINT_RADIUS)){
result = true;
setIsRightSelected();
} else {
clearIsRightSelected();
}
return result;
}
示例9: getCenter
bool MgArc::_draw(int mode, GiGraphics& gs, const GiContext& ctx, int segment) const
{
bool ret = gs.drawArc(&ctx, getCenter(), getRadius(), 0, getStartAngle(), getSweepAngle());
if (mode > 0) {
GiContext ctxln(0, GiColor(0, 126, 0, 64), kGiLineDashDot);
gs.drawLine(&ctxln, getCenter(), getStartPoint());
gs.drawLine(&ctxln, getCenter(), getEndPoint());
gs.drawLine(&ctxln, getStartPoint(), getStartPoint() + getStartTangent());
gs.drawLine(&ctxln, getEndPoint(), getEndPoint() + getEndTangent());
}
return __super::_draw(mode, gs, ctx, segment) || ret;
}
示例10: qMin
RBox RArc::getBoundingBox() const {
RVector minV;
RVector maxV;
double minX = qMin(getStartPoint().x, getEndPoint().x);
double minY = qMin(getStartPoint().y, getEndPoint().y);
double maxX = qMax(getStartPoint().x, getEndPoint().x);
double maxY = qMax(getStartPoint().y, getEndPoint().y);
if (getStartPoint().getDistanceTo(getEndPoint()) < 1.0e-6 && getRadius()
> 1.0e5) {
minV = RVector(minX, minY);
maxV = RVector(maxX, maxY);
return RBox(minV, maxV);
}
double a1 = RMath::getNormalizedAngle(!isReversed() ? startAngle : endAngle);
double a2 = RMath::getNormalizedAngle(!isReversed() ? endAngle : startAngle);
// check for left limit:
if ((a1<M_PI && a2>M_PI) ||
(a1>a2-1.0e-12 && a2>M_PI) ||
(a1>a2-1.0e-12 && a1<M_PI) ) {
minX = qMin(center.x - radius, minX);
}
// check for right limit:
if (a1 > a2-1.0e-12) {
maxX = qMax(center.x + radius, maxX);
}
// check for bottom limit:
if ((a1<(M_PI_2*3) && a2>(M_PI_2*3)) ||
(a1>a2-1.0e-12 && a2>(M_PI_2*3)) ||
(a1>a2-1.0e-12 && a1<(M_PI_2*3)) ) {
minY = qMin(center.y - radius, minY);
}
// check for top limit:
if ((a1<M_PI_2 && a2>M_PI_2) ||
(a1>a2-1.0e-12 && a2>M_PI_2) ||
(a1>a2-1.0e-12 && a1<M_PI_2) ) {
maxY = qMax(center.y + radius, maxY);
}
minV = RVector(minX, minY);
maxV = RVector(maxX, maxY);
return RBox(minV, maxV);
}
示例11: switchMajorMinor
bool REllipse::switchMajorMinor() {
if (fabs(ratio) < RS::PointTolerance) {
return false;
}
RVector vp_start=getStartPoint();
RVector vp_end=getStartPoint();
RVector vp=getMajorPoint();
setMajorPoint(RVector(-ratio*vp.y, ratio*vp.x));
setRatio(1.0/ratio);
setStartParam(getParamTo(vp_start));
setEndParam(getParamTo(vp_end));
return true;
}
示例12:
bool C3dBoundedLine::planeIntersect(const C3dWorldPoint & n, const double d, C3dWorldPoint & intersection) const
{
double t = (d-n.dot(getStartPoint()))/n.dot(getFinishPoint()-getStartPoint());
if(t>1 || t<0)
return false;
intersection = (getStartPoint() + t*(getFinishPoint()-getStartPoint())).eval();
//cout << intersection.transpose() << " intersects plane at t=" << t << endl;
if(IS_DEBUG) CHECK(!zero(intersection.dot(n) - d), "plane intersect computation failed");
return true;
}
示例13: perp
C2dBoundedLine::eLineSide C2dBoundedLine::side(const C2dImagePointPx & point) const
{
C2dImagePointPx bottom, top;
if(getStartPoint().y() > getFinishPoint().y()) {
bottom=getStartPoint();
top=getFinishPoint();
} else {
bottom=getFinishPoint();
top=getStartPoint();
}
C2dImagePointPx pll = bottom-top;
C2dImagePointPx perp(-pll.y(), pll.x());
return (perp.dot(point-bottom) < 0) ? eLeftOfLine : eRightOfLine;
}
示例14: getDegree
void RSpline::print(QDebug dbg) const {
dbg.nospace() << "RSpline(";
RShape::print(dbg);
dbg.nospace() << ", degree: " << getDegree();
dbg.nospace() << ", order: " << getOrder();
dbg.nospace() << ", closed: " << isClosed();
dbg.nospace() << ", periodic: " << isPeriodic();
dbg.nospace() << ", start point: " << getStartPoint();
dbg.nospace() << ", end point: " << getEndPoint();
QList<RVector> controlPoints = getControlPointsWrapped();
dbg.nospace() << ",\ncontrolPoints (" << controlPoints.count() << "): ";
for (int i=0; i<controlPoints.count(); ++i) {
dbg.nospace() << i << ": " << controlPoints.at(i);
}
QList<RVector> fitPoints = getFitPoints();
dbg.nospace() << ",\nfitPoints (" << fitPoints.count() << "): ";
for (int i=0; i<fitPoints.count(); ++i) {
dbg.nospace() << i << ": " << fitPoints.at(i) << ", ";
}
QList<double> knotVector = getKnotVector();
dbg.nospace() << ",\nknots (" << knotVector.count() << "): ";
for (int i=0; i<knotVector.count(); ++i) {
dbg.nospace() << i << ": " << knotVector.at(i) << ", ";
}
knotVector = getActualKnotVector();
dbg.nospace() << ",\ninternally used knots (" << knotVector.count() << "): ";
for (int i=0; i<knotVector.count(); ++i) {
dbg.nospace() << i << ": " << knotVector.at(i) << ", ";
}
}
示例15: setSignature
void setSignature(int col, int index, long value, int one, int two, int three, int four)
{
//set the at column - col, and the corresponding row infomation of the blocks four element
long start = getStartPoint(col);
if (index == -1) //means add a new value
{
signatures[start + filled_signature[col]] = value;
signatures_one[start + filled_signature[col]] = one;
signatures_two[start + filled_signature[col]] = two;
signatures_three[start + filled_signature[col]] = three;
signatures_four[start + filled_signature[col]] = four;
correspond_col[start + filled_signature[col]] = col;
filled_signature[col] = filled_signature[col] + 1;
}
else
{ //change an exist value
signatures[start + index] = value;
signatures_one[start + index] = one;
signatures_two[start + index] = two;
signatures_three[start + index] = three;
signatures_four[start + index] = four;
correspond_col[start + index] = col;
}
// printf("For col %d get start point %ld,setting to %ld,filled signatures is %ld\n", col, start, value, filled_signature[col]);
}