1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2014 projectchrono.org
5 // All rights reserved.
6 //
7 // Use of this source code is governed by a BSD-style license that can be found
8 // in the LICENSE file at the top level of the distribution and at
9 // http://projectchrono.org/license-chrono.txt.
10 //
11 // =============================================================================
12 // Authors: Alessandro Tasora, Radu Serban
13 // =============================================================================
14 
15 #include "chrono/geometry/ChLineSegment.h"
16 
17 namespace chrono {
18 namespace geometry {
19 
20 // Register into the object factory, to enable run-time dynamic creation and persistence
CH_FACTORY_REGISTER(ChLineSegment)21 CH_FACTORY_REGISTER(ChLineSegment)
22 
23 ChLineSegment::ChLineSegment(const ChLineSegment& source) : ChLine(source) {
24     pA = source.pA;
25     pB = source.pB;
26 }
27 
Evaluate(ChVector<> & pos,const double parU) const28 void ChLineSegment::Evaluate(ChVector<>& pos, const double parU) const {
29     pos = pA * (1 - parU) + pB * parU;
30 }
31 
ArchiveOUT(ChArchiveOut & marchive)32 void ChLineSegment::ArchiveOUT(ChArchiveOut& marchive) {
33     // version number
34     marchive.VersionWrite<ChLineSegment>();
35     // serialize parent class
36     ChLine::ArchiveOUT(marchive);
37     // serialize all member data:
38     marchive << CHNVP(pA);
39     marchive << CHNVP(pB);
40 }
41 
ArchiveIN(ChArchiveIn & marchive)42 void ChLineSegment::ArchiveIN(ChArchiveIn& marchive) {
43     // version number
44     /*int version =*/ marchive.VersionRead<ChLineSegment>();
45     // deserialize parent class
46     ChLine::ArchiveIN(marchive);
47     // stream in all member data:
48     marchive >> CHNVP(pA);
49     marchive >> CHNVP(pB);
50 }
51 
52 }  // end namespace geometry
53 }  // end namespace chrono
54