summaryrefslogtreecommitdiff
path: root/src/Vrml/Vrml_Normal.cxx
blob: 79959fa3c513ea643b2f3cbabff863d524572c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <Vrml_Normal.ixx>

 Vrml_Normal::Vrml_Normal(const Handle(TColgp_HArray1OfVec)& aVector)
{
 myVector = aVector;
}

 Vrml_Normal::Vrml_Normal()
{
 gp_Vec Tmp_Vec;
 myVector = new TColgp_HArray1OfVec (1,1);
 
 Tmp_Vec.SetX(0); Tmp_Vec.SetY(0); Tmp_Vec.SetZ(1);
 myVector->SetValue(1,Tmp_Vec);
}

void Vrml_Normal::SetVector(const Handle(TColgp_HArray1OfVec)& aVector)
{
 myVector = aVector;
}

Handle(TColgp_HArray1OfVec) Vrml_Normal::Vector() const 
{
 return myVector;
}

Standard_OStream& Vrml_Normal::Print(Standard_OStream& anOStream) const 
{
 Standard_Integer i;

 anOStream  << "Normal {" << endl;
 i = myVector->Lower();
 if ( myVector->Length() == 1 && 
     Abs(myVector->Value(i).X() - 0) < 0.0001 && 
     Abs(myVector->Value(i).Y() - 0) < 0.0001 && 
     Abs(myVector->Value(i).Z() - 1) < 0.0001 )
   {
    anOStream  << '}' << endl;
    return anOStream;
   }
 else 
  {
  anOStream  << "    vector [\n\t";
   for ( i = myVector->Lower(); i <= myVector->Upper(); i++ )
     {
	 anOStream << myVector->Value(i).X() << ' ' << myVector->Value(i).Y() << ' ' << myVector->Value(i).Z();
      if ( i < myVector->Length() )
	 anOStream  << ',' << endl << '\t';
     }
    anOStream << " ]" << endl;
  }  
  anOStream  << '}' << endl;

 return anOStream;
}