예제 #1
0
void UserInterface::displayMenu()
{
	char input;
	//while the user did not enter 3 (to exit the program) get the user's input
	do
	{
		cout << "Please select one of three options:" << endl;
		cout << "To enter a polynomial and have it displayed on the console, press 1" << endl;
		cout << "To enter add two polynomials together and display the result, press 2" << endl;
		cout << "To end the program, press 3" << endl;
		cin >> input;
		//if the user inputs 1, then they will be asked to enter the polynomial and it will be displayed back to them
		if (input == '1')
		{
			Polynomial polyInput;
			cout << "Please enter the polynomial" << endl;
			cin >> polyInput;
			cout << "Your polynomial: " << polyInput << endl;
		}
		//if the user enters 2, then they will be asked for two polynomials. Then the polynomials will be added together and will be displayed
		if (input == '2')
		{
			cout << "Please enter the first polynomial" << endl;
			Polynomial poly1 = getPoly();
			cout << "Now enter the second polynomial" << endl;
			Polynomial poly2 = getPoly();
			Polynomial finalPoly;
			finalPoly = poly1 + poly2;
			cout << "Your polynomial: " << finalPoly << endl;
		}
		if (input != '1' || input != '2' || input != '3')
			displayMenu();
	} while (input != '3');
예제 #2
0
vector<ExPoly> Clipping::getExPolys(const CL::PolyTree &ctree, double z,
				    double extrusionfactor)
{
  ExPolygons cexpolys;
  PolyTreeToExPolygons(&ctree, cexpolys);
  vector<ExPoly> expolys(cexpolys.size());
  for (uint j = 0 ; j < cexpolys.size(); j++) {
    expolys[j].outer = getPoly(cexpolys[0].outer, z, extrusionfactor);
    for (uint i = 0 ; i < cexpolys[j].holes.size(); i++)
      expolys[j].holes.push_back(getPoly(cexpolys[j].holes[i], z, extrusionfactor));
  }
  return expolys;
}
예제 #3
0
void MyPolygon::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
{
    //painter->save();
    Q_UNUSED(option);
    QColor color = color_;
    if(isSelected())
        color.setAlpha(125);
    else
        color.setAlpha(50);
    painter->setPen(Qt::NoPen);
    painter->setBrush(color);

    QPolygonF poly = getPoly();
    setPolygon(poly);

    painter->drawPolygon(poly,Qt::WindingFill);

    painter->setPen(Qt::black);
    //qDebug() << pattern_->getName();
    //QRect rect(0,0,200,50);
    //painter->drawText(rect, Qt::AlignCenter, pattern_->getName());
    painter->drawText(poly.boundingRect(), Qt::AlignCenter, pattern_->getName());
    //painter->drawText(QRect(pattern_->getPolygon().at(0).toPoint(),QSize(200,50)), Qt::AlignCenter, pattern_->getName());
    //painter->restore();
}
예제 #4
0
vector<Poly> Clipping::getPolys(const CL::Polygons &cpolys, double z, double extrusionfactor)
{
  uint count = cpolys.size();
  vector<Poly> polys(count);
  for (uint i = 0 ; i<count;  i++)
    polys[i] = getPoly(cpolys[i], z, extrusionfactor);
  return polys;
}
예제 #5
0
파일: 5.c 프로젝트: TyOverby/C-Programming
int main(void){
	printf("please enter a number:\n");

	float input;
	scanf("%f",&input);

	printf("%f\n",getPoly(input));

}
예제 #6
0
	bool CoCoAGBModule<Settings>::addCore( ModuleInput::const_iterator _subformula )
	{
		assert(_subformula->formula().getType() == carl::FormulaType::CONSTRAINT);
		auto p = getPoly(_subformula->formula().constraint());
		if (p) {
			mGBPolys.emplace(_subformula->formula().constraint(), *p);
			mLastBasis.clear();
		} else {
			addReceivedSubformulaToPassedFormula(_subformula);
		}
		return true;
	}
예제 #7
0
void PlatePipe::plateTransformation(vtkSmartPointer<vtkTransform> & apVTKTransform)	{
	//Transform generic plate
	vtkSmartPointer <vtkPolyData> poly = getPoly();

	vtkSmartPointer <vtkTransformPolyDataFilter> transformedPoly = vtkSmartPointer <vtkTransformPolyDataFilter>::New();
	transformedPoly->SetInput(poly);
	transformedPoly->SetTransform(apVTKTransform);
	transformedPoly->Update();

	vtkSmartPointer<vtkPolyDataMapper> m_pVTKPolyDataMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
	m_pVTKPolyDataMapper->SetInputConnection(transformedPoly->GetOutputPort());

	m_pVTKActor = vtkSmartPointer<vtkActor>::New();
	m_pVTKActor->SetMapper(m_pVTKPolyDataMapper);
}