Ejemplo n.º 1
0
void
LineoutAttributes::Print(ostream &out, bool selected_only) const
{
    out << "LineoutAttributes" << "\n";
    out << "{";
    const double *pt;
    int i;
    for(i = 0; i < NumAttributes(); ++i)
    {
        if(selected_only && !IsSelected(i))
            continue;

        switch(i)
        {
          case  0: pt = GetPoint1();
                   out << "point1=" << pt[0] << " " 
                                    << pt[1] << " "
                                    << pt[2] << endl;          break;
          case  1: pt = GetPoint2();
                   out << "point2=" << pt[0] << " " 
                                    << pt[1] << " "
                                    << pt[2] << endl;          break;
          case  2: out << "sampling on? " << GetSamplingOn();  break;
          case  3: out << "numberOfSamplePoints=" 
                       << GetNumberOfSamplePoints();    break;
        }
        out << ",";
    }

    out << "}";

}
Ejemplo n.º 2
0
AttributeSubject *
LineoutAttributes::CreateCompatible(const std::string &tname) const
{
    AttributeSubject *retval = 0;

    if(TypeName() == tname)
    {
        retval = new LineoutAttributes(*this);
    }
    else if(tname == "Line")
    {
        Line *line = new Line;

        line->SetPoint1(GetPoint1());
        line->SetPoint2(GetPoint2());
        line->SetInteractive(GetInteractive());
        line->SetReflineLabels(GetReflineLabels());
        line->SetDesignator(GetDesignator());
        line->SetSamplingOn(GetSamplingOn());
        line->SetNumSamples(GetNumberOfSamplePoints());
        retval = line;
    }

    return retval;
}
Ejemplo n.º 3
0
void
QuadraticBezierSegment::Append (moon_path *path)
{
	Point *p1 = GetPoint1 ();
	Point *p2 = GetPoint2 ();

	double x1 = p1 ? p1->x : 0.0;
	double y1 = p1 ? p1->y : 0.0;
	double x2 = p2 ? p2->x : 0.0;
	double y2 = p2 ? p2->y : 0.0;

	moon_quad_curve_to (path, x1, y1, x2, y2);
}
Ejemplo n.º 4
0
void
BezierSegment::Append (moon_path *path)
{
	Point *p1 = GetPoint1 ();
	Point *p2 = GetPoint2 ();
	Point *p3 = GetPoint3 ();
	
	double x1 = p1 ? p1->x : 0.0;
	double y1 = p1 ? p1->y : 0.0;
	double x2 = p2 ? p2->x : 0.0;
	double y2 = p2 ? p2->y : 0.0;
	double x3 = p3 ? p3->x : 0.0;
	double y3 = p3 ? p3->y : 0.0;

	moon_curve_to (path, x1, y1, x2, y2, x3, y3);
}
Ejemplo n.º 5
0
Pulley::Pulley(int length, int numberOfPartciles, SGD::Vector location)
{
	index = 0;
	r = new Rope(length, numberOfPartciles, location);
	SetPoint1({ r->GetParticleAt(10)->GetCurrPosition().x-100.0f, r->GetParticleAt(10)->GetCurrPosition().y -100.0f });
	SetPoint2({ r->GetParticleAt(10)->GetCurrPosition().x, r->GetParticleAt(10)->GetCurrPosition().y - 200.0f });
	SetPoint3({ r->GetParticleAt(10)->GetCurrPosition().x+50.0f, r->GetParticleAt(10)->GetCurrPosition().y - 180.0f });
	
	r->GetParticleAt(9)->SetFixed(true);
	r->GetParticleAt(10)->SetFixed(true);
	r->GetParticleAt(11)->SetFixed(true);
	r->GetParticleAt(9)->SetCurrPosition(GetPoint1());
	r->GetParticleAt(10)->SetCurrPosition(GetPoint2());
	r->GetParticleAt(11)->SetCurrPosition(GetPoint3());
	r->GetParticleAt(19)->SetMass(800.0f);
	r->GetParticleAt(0)->SetCurrPosition({ r->GetParticleAt(9)->GetCurrPosition().x-100.0f, r->GetParticleAt(9)->GetCurrPosition().y + 150.0f });
	r->GetParticleAt(19)->SetCurrPosition({ r->GetParticleAt(11)->GetCurrPosition().x +150.0f, r->GetParticleAt(11)->GetCurrPosition().y + 150.0f });
}
Ejemplo n.º 6
0
AttributeSubject *
CylinderAttributes::CreateCompatible(const std::string &tname) const
{
    AttributeSubject *retval = 0;

    if(TypeName() == tname)
    {
        retval = new CylinderAttributes(*this);
    }
    else if(tname == "Line")
    {
        Line *line = new Line;

        line->SetPoint1(GetPoint1());
        line->SetPoint2(GetPoint2());
        retval = line;
    }

    return retval;
}