//----------------------------------------------------------------// float ZLInterpolate::Curve ( u32 mode, float t, float w ) { float v0 = Curve ( kLinear, t ); float v1 = Curve ( mode, t ); return Interpolate ( kLinear, v0, v1, w ); }
void Nose::setPosition(Point P) { location = P; int x = P.getAbsis(); int y = P.getOrdinat(); vector<Point> part1 = {Point(x-27,y-22),Point(x-31,y-12),Point(x-33,y-4),Point(x-28,y+1)}; vector<Point> part2 = {Point(x-28,y+1),Point(x-24,y-3),Point(x-17,y+4),Point(x-8,y+11),Point(x+1,y+15)}; vector<Point> part3 = {Point(x+28,y+1),Point(x+24,y-3),Point(x+17,y+4),Point(x+8,y+11),Point(x-1,y+15)}; vector<Point> part4 = {Point(x+27,y-22),Point(x+31,y-12),Point(x+33,y-4),Point(x+28,y+1)}; vector<Point> part5 = {Point(x-4,y-54),Point(x-7,y-23),Point(x-6,y-11),Point(x+1,y+2)}; nosePoint = {part1,part2,part3,part4,part5}; vector<Curve> noseDesc = {Curve(part1),Curve(part2),Curve(part3),Curve(part4), Curve(part5)}; nosePart = noseDesc; }
void CRhinoRectangleObject::EnableGrips( bool bGripsOn ) { if( bGripsOn ) theRectangleGripsRegistrar.RegisterGrips(); if( !bGripsOn || (m_grips && 0 == CRhinoRectangleGrips::RectangleGrips(m_grips)) ) { // turn off wrong kind of grips CRhinoObject::EnableGrips( false ); } CRhinoDoc* doc = RhinoApp().ActiveDoc(); if( bGripsOn && !m_grips ) { const ON_PolylineCurve* pline = Curve(); if( pline ) { // turn on rectangle grips CRhinoRectangleGrips* rectangle_grips = new CRhinoRectangleGrips(); if( rectangle_grips->CreateGrips( *pline) ) CRhinoObject::EnableCustomGrips( rectangle_grips ); else delete rectangle_grips; } } }
void Painter::CurveTo (Canvas* c, Coord x0, Coord y0, Coord x1, Coord y1, Coord x2, Coord y2 ) { Curve(c, curx, cury, x0, y0, x1, y1, x2, y2); curx = x2; cury = y2; }
void CoordSystem::addGraphCurveAtEnd (const QString &curveName) { m_curvesGraphs.addGraphCurveAtEnd (Curve (curveName, ColorFilterSettings::defaultFilter (), CurveStyle (LineStyle::defaultGraphCurve(m_curvesGraphs.numCurves()), PointStyle::defaultGraphCurve(m_curvesGraphs.numCurves())))); }
//----------------------------------------------------------------// float ZLInterpolate::Interpolate ( u32 mode, float x0, float x1, float t ) { if ( mode == kFlat ) { return ( t < 1.0f ) ? x0 : x1; } float s = Curve ( mode, t ); return x0 + (( x1 - x0 ) * s ); }
bool read_general_conic(stream& is, Curve& cv) { // Read a general conic, given by its coefficients <r,s,t,u,v,w>. Rational r, s, t, u, v, w; is >> r >> s >> t >> u >> v >> w; // Create a full conic (should work only for ellipses). cv = Curve(r, s, t, u, v, w); return true; }
void curves(void) { int i; for (i = entrysize-1; i>=0; i--) { Curve(i,entrydata[i]); } if (showSample) Samples(); }
Curve Curve::mirror(int x) { vector<Point> points = getAllPoints(); vector<Point> newpoints; for (int i=0;i<points.size();i++) { Point P = points[i].mirror(x); newpoints.push_back(P); } return Curve(newpoints); }
void ChecklistGuideWizard::populateCurvesGraphs (CurvesGraphs &curvesGraphs) { LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::populateCurvesGraphs"; QStringList curveNames = m_pageCurves->curveNames(); QStringList::const_iterator itr; for (itr = curveNames.begin(); itr != curveNames.end(); itr++) { QString curveName = *itr; curvesGraphs.addGraphCurveAtEnd(Curve (curveName, ColorFilterSettings::defaultFilter (), CurveStyle (LineStyle::defaultGraphCurve (curvesGraphs.numCurves ()), PointStyle::defaultGraphCurve (curvesGraphs.numCurves ())))); } }
void Nose::setScale(double s,Point center) { scale = s; vector<vector<Point>> np = nosePoint; nosePoint.clear(); nosePart.clear(); for(int i = 0; i < np.size();i++) { vector<Point> vp; for(int j =0 ; j < np[i].size(); j++) { Point tmp = (np[i])[j]; tmp.scale(s,center); vp.push_back(tmp); } nosePoint.push_back(vp); nosePart.push_back(Curve(vp)); } }
CoordSystem::CoordSystem (DocumentAxesPointsRequired documentAxesPointsRequired) : m_curveAxes (new Curve (AXIS_CURVE_NAME, ColorFilterSettings::defaultFilter (), CurveStyle (LineStyle::defaultAxesCurve(), PointStyle::defaultAxesCurve ()))), m_documentAxesPointsRequired (documentAxesPointsRequired) { LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::CoordSystem"; SettingsForGraph settingsForGraph; QString curveName = settingsForGraph.defaultCurveName (1, DEFAULT_GRAPH_CURVE_NAME); m_curvesGraphs.addGraphCurveAtEnd (Curve (curveName, ColorFilterSettings::defaultFilter (), CurveStyle (LineStyle::defaultGraphCurve (m_curvesGraphs.numCurves ()), PointStyle::defaultGraphCurve (m_curvesGraphs.numCurves ())))); }
bool read_general_curve(stream& is, Curve& cv) { Rational r, s, t, u, v, w; // The conic coefficients. // Read a general conic, given by its coefficients <r,s,t,u,v,w>. is >> r >> s >> t >> u >> v >> w; CGAL::Orientation orient; Conic_point_2 source, target; if (!read_orientation_and_end_points(is, orient, source, target)) return false; // Create the conic (or circular) arc. // std::cout << "arc coefficients: " << r << " " << s << " " << t << " " // << u << " " << v << " " << w << std::endl; // std::cout << "Read Points : " << source.x() << " " << source.y() << " " // << target.x() << " " << target.y() << std::endl; cv = Curve(r, s, t, u, v, w, orient, source, target); return true; }
bool read_general_arc(stream& is, Curve& cv) { // Read a general conic, given by its coefficients <r,s,t,u,v,w>. Rational r, s, t, u, v, w; // The conic coefficients. is >> r >> s >> t >> u >> v >> w; // Read the orientation. int i_orient = 0; is >> i_orient; CGAL::Orientation orient = (i_orient > 0) ? CGAL::COUNTERCLOCKWISE : (i_orient < 0) ? CGAL::CLOCKWISE : CGAL::COLLINEAR; // Read the approximated source, along with a general conic // <r_1,s_1,t_1,u_1,v_1,w_1> whose intersection with <r,s,t,u,v,w> // defines the source. Conic_point_2 app_source; if (!read_app_point(is, app_source)) return false; Rational r1, s1, t1, u1, v1, w1; is >> r1 >> s1 >> t1 >> u1 >> v1 >> w1; // Read the approximated target, along with a general conic // <r_2,s_2,t_2,u_2,v_2,w_2> whose intersection with <r,s,t,u,v,w> // defines the target. Conic_point_2 app_target; if (!read_app_point(is, app_target)) return false; Rational r2, s2, t2, u2, v2, w2; is >> r2 >> s2 >> t2 >> u2 >> v2 >> w2; std::cout << "line is: " << r << s << t << u << v << w << i_orient << r1 << s1 << t1 << u1 << v1 << w1 << r2 << s2 << t2 << u2 << v2 << w2 << std::endl; // Create the conic arc. cv = Curve(r, s, t, u, v, w, orient, app_source, r1, s1, t1, u1, v1, w1, app_target, r2, s2, t2, u2, v2, w2); return true; }
int point_cmp(const EC_POINT x, const EC_POINT y) { return Curve(x)->cmp(x, y); }
LIBSBML_EXTERN Curve_t * Curve_createFrom (const Curve_t *temp) { return new(std::nothrow) Curve(temp ? *temp : Curve()); }
//----------------------------------------------------------------// float ZLInterpolate::Interpolate ( u32 mode, float x0, float x1, float t, float w ) { float s = Curve ( mode, t, w ); return x0 + (( x1 - x0 ) * s ); }
void EPSPlug::parseOutput(QString fn, bool eps) { QString tmp, token, params, lasttoken, lastPath, currPath; int z, lcap, ljoin, dc, pagecount; int failedImages = 0; double dcp; bool fillRuleEvenOdd = true; PageItem* ite; QStack<PageItem*> groupStack; QStack< QList<PageItem*> > groupStackP; QStack<int> gsStack; QStack<uint> gsStackMarks; QFile f(fn); lasttoken = ""; pagecount = 1; if (f.open(QIODevice::ReadOnly)) { int fProgress = 0; int fSize = (int) f.size(); if (progressDialog) { progressDialog->setTotalSteps("GI", fSize); qApp->processEvents(); } lastPath = ""; currPath = ""; LineW = 0; Opacity = 1; CurrColor = CommonStrings::None; JoinStyle = Qt::MiterJoin; CapStyle = Qt::FlatCap; DashPattern.clear(); ScTextStream ts(&f); int line_cnt = 0; while (!ts.atEnd() && !cancel) { tmp = ""; tmp = ts.readLine(); if (progressDialog && (++line_cnt % 100 == 0)) { int fPos = f.pos(); int progress = static_cast<int>(ceil(fPos / (double) fSize * 100)); if (progress > fProgress) { progressDialog->setProgress("GI", fPos); qApp->processEvents(); fProgress = progress; } } token = tmp.section(' ', 0, 0); params = tmp.section(' ', 1, -1, QString::SectionIncludeTrailingSep); if (lasttoken == "sp" && !eps && token != "sp" ) //av: messes up anyway: && (!interactive)) { m_Doc->addPage(pagecount); m_Doc->view()->addPage(pagecount, true); pagecount++; } if (token == "n") { Coords.resize(0); FirstM = true; WasM = false; ClosedPath = false; } else if (token == "m") WasM = true; else if (token == "c") { Curve(&Coords, params); currPath += params; } else if (token == "l") { LineTo(&Coords, params); currPath += params; } else if (token == "fill-winding") { fillRuleEvenOdd = false; } else if (token == "fill-evenodd") { fillRuleEvenOdd = true; } else if (token == "f") { //TODO: pattern -> Imageframe + Clip if (Coords.size() != 0) { if ((Elements.count() != 0) && (lastPath == currPath)) { ite = Elements.last(); ite->setFillColor(CurrColor); ite->setFillTransparency(1.0 - Opacity); lastPath = ""; } else { if (ClosedPath) z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColor, CommonStrings::None); else z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColor, CommonStrings::None); ite = m_Doc->Items->at(z); ite->PoLine = Coords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); ite->ClipEdited = true; ite->FrameType = 3; ite->fillRule = (fillRuleEvenOdd); FPoint wh = getMaxClipF(&ite->PoLine); ite->setWidthHeight(wh.x(),wh.y()); ite->Clip = FlattenPath(ite->PoLine, ite->Segments); ite->setFillTransparency(1.0 - Opacity); ite->setTextFlowMode(PageItem::TextFlowDisabled); m_Doc->AdjustItemSize(ite); if (ite->itemType() == PageItem::Polygon) ite->ContourLine = ite->PoLine.copy(); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) groupStackP.top().append(ite); Elements.append(ite); lastPath = currPath; } currPath = ""; } } else if (token == "s") { if (Coords.size() != 0) { // LineW = qMax(LineW, 0.01); // Set Linewidth to be a least 0.01 pts, a Stroke without a Linewidth makes no sense if ((Elements.count() != 0) && (lastPath == currPath)) { ite = Elements.last(); ite->setLineColor(CurrColor); ite->setLineWidth(LineW); ite->PLineEnd = CapStyle; ite->PLineJoin = JoinStyle; ite->setLineTransparency(1.0 - Opacity); ite->DashOffset = DashOffset; ite->DashValues = DashPattern; } else { if (ClosedPath) z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColor); else z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColor); ite = m_Doc->Items->at(z); ite->PoLine = Coords.copy(); //FIXME: try to avoid copy when FPointArray is properly shared ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); ite->ClipEdited = true; ite->FrameType = 3; ite->PLineEnd = CapStyle; ite->PLineJoin = JoinStyle; ite->DashOffset = DashOffset; ite->DashValues = DashPattern; FPoint wh = getMaxClipF(&ite->PoLine); ite->setWidthHeight(wh.x(), wh.y()); ite->Clip = FlattenPath(ite->PoLine, ite->Segments); ite->setLineTransparency(1.0 - Opacity); m_Doc->AdjustItemSize(ite); if (ite->itemType() == PageItem::Polygon) ite->ContourLine = ite->PoLine.copy(); ite->setLineWidth(LineW); ite->setTextFlowMode(PageItem::TextFlowDisabled); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) groupStackP.top().append(ite); Elements.append(ite); } lastPath = ""; currPath = ""; } } else if (token == "co") CurrColor = parseColor(params, eps); else if (token == "corgb") CurrColor = parseColor(params, eps, colorModelRGB); else if (token == "ci") { if (Coords.size() != 0) { QPainterPath tmpPath = Coords.toQPainterPath(true); tmpPath = boundingBoxRect.intersected(tmpPath); if ((tmpPath.boundingRect().width() != 0) && (tmpPath.boundingRect().height() != 0)) { clipCoords.fromQPainterPath(tmpPath); z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None); ite = m_Doc->Items->at(z); ite->PoLine = clipCoords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); ite->ClipEdited = true; ite->FrameType = 3; FPoint wh = getMaxClipF(&ite->PoLine); ite->setWidthHeight(wh.x(),wh.y()); ite->Clip = FlattenPath(ite->PoLine, ite->Segments); m_Doc->AdjustItemSize(ite, true); ite->ContourLine = ite->PoLine.copy(); ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter)); ite->setTextFlowMode(PageItem::TextFlowDisabled); Elements.append(ite); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) groupStackP.top().append(ite); groupStack.push(ite); QList<PageItem*> gElements; groupStackP.push(gElements); gsStackMarks.push(gsStack.count()); m_Doc->GroupCounter++; } } Coords = FPointArray(0); lastPath = ""; currPath = ""; } else if (token == "gs") { gsStack.push(1); } else if (token == "gr") { // #6834 : self defense against incorrectly balanced save/restore if (gsStack.count() > 0) gsStack.pop(); if ((groupStack.count() != 0) && (groupStackP.count() != 0)) { if (gsStack.count() < static_cast<int>(gsStackMarks.top())) { PageItem *ite = groupStack.pop(); QList<PageItem*> gList = groupStackP.pop(); for (int d = 0; d < gList.count(); d++) { Elements.removeAll(gList.at(d)); } m_Doc->groupObjectsToItem(ite, gList); gsStackMarks.pop(); } } } else if (token == "w") { ScTextStream Lw(¶ms, QIODevice::ReadOnly); Lw >> LineW; } else if (token == "ld")
void point_dob(EC_POINT Q, const EC_POINT P) { Curve(P)->dob(Q, P); }
void point_from_oct(EC_POINT P, const unsigned char *os, size_t size) { Curve(P)->from_oct(P, os, size); }
void point_neg(EC_POINT Q, const EC_POINT P) { Curve(P)->neg(Q, P); }
void point_random(EC_POINT P) { Curve(P)->random(P); }
void point_to_oct(unsigned char *os, size_t *size, EC_POINT P) { Curve(P)->to_oct(os, size, P); }
void point_map_to_point(EC_POINT z, const char *s, size_t slen, int t) { Curve(z)->map_to_point(z, s, slen, t); }
void point_sub(EC_POINT z, const EC_POINT x, const EC_POINT y) { Curve(x)->sub(z, x, y); }
MStatus CreateCurves::createCurve(Model::Strand & strand) { MStatus status; std::cerr << "Working with strand defined by base: " << strand.getDefiningBase().getDagPath(status).fullPathName().asChar() << std::endl; /* * Make sure this base is an end base (5') */ Model::Strand::BackwardIterator base_it = std::find_if(strand.reverse_begin(), strand.reverse_end(), Model::Strand::BaseTypeFunc(Model::Base::FIVE_PRIME_END)); /* * If we found an end base, use it, if not, it's a loop and it wont matter but we have to close the curve */ bool isLoop = base_it == strand.reverse_end(); Model::Strand strand_(isLoop ? strand.getDefiningBase() : *base_it); std::cerr << "5' end or loop base: " << strand_.getDefiningBase().getDagPath(status).fullPathName().asChar() << std::endl; MPointArray pointArray; MDoubleArray knotSequences; /* * Notice that the first point is different, it is as if it was inserted 4 times * Also notice that radius is probably normally never changed, but is taken into account * radius is only measured on the X,Y plane */ MVector translation; for(Model::Strand::ForwardIterator it = strand_.forward_begin(); it != strand_.forward_end(); ++it) { /* * Extract our coordinates, then interpolate between the last coordinates and these m_degree times */ if (!(status = it->getTranslation(translation, MSpace::kWorld))) { status.perror("Base::getTranslation"); return status; } pointArray.append(translation); } /* * Now create the CV curve */ knotSequences.setSizeIncrement(pointArray.length() + 2 * (unsigned int) m_degree - 1); for(int i = 0; i < m_degree - 1; ++i) knotSequences.append(0); for(unsigned int i = 0; i < pointArray.length() - 2; ++i) knotSequences.append(i); for(int i = 0; i < m_degree - 1; ++i) knotSequences.append(pointArray.length() - 3); m_curve_data.push_back(Curve(pointArray, knotSequences, isLoop)); if (!(status = m_curve_data.back().create(*this))) { status.perror("Curve::create"); return status; } return MStatus::kSuccess; }
int point_is_on_curve(const EC_POINT x) { return Curve(x)->is_on_curve(x); }
void point_mul(EC_POINT z, const mpz_t s, const EC_POINT x) { Curve(x)->mul(z, s, x); }
CPointsToLinearBSpline::operator Handle(Geom_BSplineCurve)() const { return Curve(); }
void point_make_affine(EC_POINT z, const EC_POINT x) { Curve(x)->make_affine(z, x); }