-
Notifications
You must be signed in to change notification settings - Fork 1
/
coresubmesh.cpp
709 lines (579 loc) · 25.2 KB
/
coresubmesh.cpp
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
//****************************************************************************//
// coresubmesh.cpp //
// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
//****************************************************************************//
// This library is free software; you can redistribute it and/or modify it //
// under the terms of the GNU Lesser General Public License as published by //
// the Free Software Foundation; either version 2.1 of the License, or (at //
// your option) any later version. //
//****************************************************************************//
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//****************************************************************************//
// Includes //
//****************************************************************************//
#include "cal3d/coresubmesh.h"
#include "cal3d/coresubmorphtarget.h"
/*****************************************************************************/
/** Constructs the core submesh instance.
*
* This function is the default constructor of the core submesh instance.
*****************************************************************************/
CalCoreSubmesh::CalCoreSubmesh()
: m_coreMaterialThreadId(0), m_lodCount(0)
{
}
/*****************************************************************************/
/** Destructs the core submesh instance.
*
* This function is the destructor of the core submesh instance.
*****************************************************************************/
CalCoreSubmesh::~CalCoreSubmesh()
{
// destroy all data
m_vectorFace.clear();
m_vectorVertex.clear();
m_vectorPhysicalProperty.clear();
m_vectorvectorTextureCoordinate.clear();
m_vectorSpring.clear();
m_vectorTangentsEnabled.clear();
m_vectorvectorTangentSpace.clear();
// destroy all core sub morph targets
std::vector<CalCoreSubMorphTarget *>::iterator iteratorCoreSubMorphTarget;
for(iteratorCoreSubMorphTarget = m_vectorCoreSubMorphTarget.begin(); iteratorCoreSubMorphTarget != m_vectorCoreSubMorphTarget.end(); ++iteratorCoreSubMorphTarget)
{
delete (*iteratorCoreSubMorphTarget);
}
m_vectorCoreSubMorphTarget.clear();
}
/*****************************************************************************/
/** Returns the ID of the core material thread.
*
* This function returns the ID of the core material thread of this core
* submesh instance.
*
* @return The ID of the core material thread.
*****************************************************************************/
int CalCoreSubmesh::getCoreMaterialThreadId()
{
return m_coreMaterialThreadId;
}
/*****************************************************************************/
/** Returns the number of faces.
*
* This function returns the number of faces in the core submesh instance.
*
* @return The number of faces.
*****************************************************************************/
int CalCoreSubmesh::getFaceCount()
{
return m_vectorFace.size();
}
/*****************************************************************************/
/** Returns the number of LOD steps.
*
* This function returns the number of LOD steps in the core submesh instance.
*
* @return The number of LOD steps.
*****************************************************************************/
int CalCoreSubmesh::getLodCount()
{
return m_lodCount;
}
/*****************************************************************************/
/** Returns the number of springs.
*
* This function returns the number of springs in the core submesh instance.
*
* @return The number of springs.
*****************************************************************************/
int CalCoreSubmesh::getSpringCount()
{
return m_vectorSpring.size();
}
/*****************************************************************************/
/** Returns true if tangent vectors are enabled.
*
* This function returns true if the core submesh contains tangent vectors.
*
* @return True if tangent vectors are enabled.
*****************************************************************************/
bool CalCoreSubmesh::isTangentsEnabled(int mapId)
{
if((mapId < 0) || (mapId >= (int)m_vectorTangentsEnabled.size())) return false;
return m_vectorTangentsEnabled[mapId];
}
/*****************************************************************************/
/** UpdateTangentVector
*
*****************************************************************************/
void CalCoreSubmesh::UpdateTangentVector(int v0, int v1, int v2, int mapId, std::vector<CalVector>& bitangents)
{
std::vector<CalCoreSubmesh::Vertex> &vvtx = getVectorVertex();
std::vector<CalCoreSubmesh::TextureCoordinate> &vtex = m_vectorvectorTextureCoordinate[mapId];
// Step 1. Compute the approximate tangent vector.
float du1 = vtex[v1].u - vtex[v0].u;
float dv1 = vtex[v1].v - vtex[v0].v;
float du2 = vtex[v2].u - vtex[v0].u;
float dv2 = vtex[v2].v - vtex[v0].v;
float prod1 = (du1*dv2-dv1*du2);
if ((fabs(prod1) < 0.000001)) return;
//double prod2 = (du2*dv1-dv2*du1);
//if ((fabs(prod1) < 0.000001)||(fabs(prod2) < 0.000001)) return;
//double x = dv2/prod1;
//double y = dv1/prod2;
CalVector vec1 = vvtx[v1].position - vvtx[v0].position;
CalVector vec2 = vvtx[v2].position - vvtx[v0].position;
//CalVector tangent = (vec1 * ((float)x)) + (vec2 * ((float)y));
CalVector tangent((dv2 * vec1.x - dv1 * vec2.x) / prod1,
(dv2 * vec1.y - dv1 * vec2.y) / prod1,
(dv2 * vec1.z - dv1 * vec2.z) / prod1);
CalVector bitangent((du1 * vec2.x - du2 * vec1.x) / prod1,
(du1 * vec2.y - du2 * vec1.y) / prod1,
(du1 * vec2.z - du2 * vec1.z) / prod1);
// Step 2. Orthonormalize the tangent and bitangent.
double component = (tangent * vvtx[v0].normal);
tangent -= (vvtx[v0].normal * ((float)component));
tangent.normalize();
component = (bitangent * vvtx[v0].normal);
bitangent -= (vvtx[v0].normal * ((float)component));
bitangent.normalize();
// Step 3: Add the estimated tangent and bitangent to the overall estimate for the vertex.
m_vectorvectorTangentSpace[mapId][v0].tangent+=tangent;
bitangents[v0] += bitangent;
}
/*****************************************************************************/
/** Enables (and calculates) or disables the storage of tangent spaces.
*
* This function enables or disables the storage of tangent space bases.
*****************************************************************************/
bool CalCoreSubmesh::enableTangents(int mapId, bool enabled)
{
if((mapId < 0) || (mapId >= (int)m_vectorTangentsEnabled.size())) return false;
m_vectorTangentsEnabled[mapId] = enabled;
if(!enabled)
{
m_vectorvectorTangentSpace[mapId].clear();
return true;
}
m_vectorvectorTangentSpace[mapId].reserve(m_vectorVertex.size());
m_vectorvectorTangentSpace[mapId].resize(m_vectorVertex.size());
int tangentId;
for(tangentId=0;tangentId< (int)m_vectorvectorTangentSpace[mapId].size();tangentId++)
{
m_vectorvectorTangentSpace[mapId][tangentId].tangent= CalVector(0.0f,0.0f,0.0f);
m_vectorvectorTangentSpace[mapId][tangentId].crossFactor=1;
}
std::vector<CalVector> bitangents;
bitangents.resize(m_vectorVertex.size(), CalVector(0.0f,0.0f,0.0f));
int faceId;
for(faceId=0;faceId<(int)m_vectorFace.size();faceId++)
{
UpdateTangentVector(m_vectorFace[faceId].vertexId[0],m_vectorFace[faceId].vertexId[1],m_vectorFace[faceId].vertexId[2],mapId, bitangents);
UpdateTangentVector(m_vectorFace[faceId].vertexId[1],m_vectorFace[faceId].vertexId[2],m_vectorFace[faceId].vertexId[0],mapId, bitangents);
UpdateTangentVector(m_vectorFace[faceId].vertexId[2],m_vectorFace[faceId].vertexId[0],m_vectorFace[faceId].vertexId[1],mapId, bitangents);
}
for(tangentId=0;tangentId< (int)m_vectorvectorTangentSpace[mapId].size();tangentId++)
{
CalVector& n = m_vectorVertex[tangentId].normal;
CalVector& t = m_vectorvectorTangentSpace[mapId][tangentId].tangent;
// Gram-Schmidt orthogonalize
t = (t - (n * (n * t)));
t.normalize();
bitangents[tangentId].normalize();
// Calculate handedness
m_vectorvectorTangentSpace[mapId][tangentId].crossFactor = (((n % t) * bitangents[tangentId]) < 0.0) ? -1.0 : 1.0;
}
return true;
}
/*****************************************************************************/
/** Returns the face vector.
*
* This function returns the vector that contains all faces of the core submesh
* instance.
*
* @return A reference to the face vector.
*****************************************************************************/
std::vector<CalCoreSubmesh::Face>& CalCoreSubmesh::getVectorFace()
{
return m_vectorFace;
}
/*****************************************************************************/
/** Returns the physical property vector.
*
* This function returns the vector that contains all physical properties of
* the core submesh instance.
*
* @return A reference to the physical property vector.
*****************************************************************************/
std::vector<CalCoreSubmesh::PhysicalProperty>& CalCoreSubmesh::getVectorPhysicalProperty()
{
return m_vectorPhysicalProperty;
}
/*****************************************************************************/
/** Returns the spring vector.
*
* This function returns the vector that contains all springs of the core
* submesh instance.
*
* @return A reference to the spring vector.
*****************************************************************************/
std::vector<CalCoreSubmesh::Spring>& CalCoreSubmesh::getVectorSpring()
{
return m_vectorSpring;
}
/*****************************************************************************/
/** Returns the texture coordinate vector-vector.
*
* This function returns the vector that contains all texture coordinate
* vectors of the core submesh instance. This vector contains another vector
* because there can be more than one texture map at each vertex.
*
* @return A reference to the texture coordinate vector-vector.
*****************************************************************************/
std::vector<std::vector<CalCoreSubmesh::TextureCoordinate> > & CalCoreSubmesh::getVectorVectorTextureCoordinate()
{
return m_vectorvectorTextureCoordinate;
}
/*****************************************************************************/
/** Returns the tangent space vector-vector.
*
* This function returns the vector that contains all tangent space bases of
* the core submesh instance. This vector contains another vector
* because there can be more than one texture map at each vertex.
*
* @return A reference to the tangent space vector-vector.
*****************************************************************************/
std::vector<std::vector<CalCoreSubmesh::TangentSpace> >& CalCoreSubmesh::getVectorVectorTangentSpace()
{
return m_vectorvectorTangentSpace;
}
/*****************************************************************************/
/** Returns the vertex vector.
*
* This function returns the vector that contains all vertices of the core
* submesh instance.
*
* @return A reference to the vertex vector.
*****************************************************************************/
std::vector<CalCoreSubmesh::Vertex>& CalCoreSubmesh::getVectorVertex()
{
return m_vectorVertex;
}
/*****************************************************************************/
/** Returns the number of vertices.
*
* This function returns the number of vertices in the core submesh instance.
*
* @return The number of vertices.
*****************************************************************************/
int CalCoreSubmesh::getVertexCount()
{
return m_vectorVertex.size();
}
/*****************************************************************************/
/** Reserves memory for the vertices, faces and texture coordinates.
*
* This function reserves memory for the vertices, faces, texture coordinates
* and springs of the core submesh instance.
*
* @param vertexCount The number of vertices that this core submesh instance
* should be able to hold.
* @param textureCoordinateCount The number of texture coordinates that this
* core submesh instance should be able to hold.
* @param faceCount The number of faces that this core submesh instance should
* be able to hold.
* @param springCount The number of springs that this core submesh instance
* should be able to hold.
*
* @return One of the following values:
* \li \b true if successful
* \li \b false if an error happend
*****************************************************************************/
bool CalCoreSubmesh::reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount)
{
// reserve the space needed in all the vectors
m_vectorVertex.reserve(vertexCount);
m_vectorVertex.resize(vertexCount);
m_vectorTangentsEnabled.reserve(textureCoordinateCount);
m_vectorTangentsEnabled.resize(textureCoordinateCount);
m_vectorvectorTangentSpace.reserve(textureCoordinateCount);
m_vectorvectorTangentSpace.resize(textureCoordinateCount);
m_vectorvectorTextureCoordinate.reserve(textureCoordinateCount);
m_vectorvectorTextureCoordinate.resize(textureCoordinateCount);
int textureCoordinateId;
for(textureCoordinateId = 0; textureCoordinateId < textureCoordinateCount; ++textureCoordinateId)
{
m_vectorvectorTextureCoordinate[textureCoordinateId].reserve(vertexCount);
m_vectorvectorTextureCoordinate[textureCoordinateId].resize(vertexCount);
if (m_vectorTangentsEnabled[textureCoordinateId])
{
m_vectorvectorTangentSpace[textureCoordinateId].reserve(vertexCount);
m_vectorvectorTangentSpace[textureCoordinateId].resize(vertexCount);
}
else
{
m_vectorvectorTangentSpace[textureCoordinateId].clear();
}
}
m_vectorFace.reserve(faceCount);
m_vectorFace.resize(faceCount);
m_vectorSpring.reserve(springCount);
m_vectorSpring.resize(springCount);
// reserve the space for the physical properties if we have springs in the core submesh instance
if(springCount > 0)
{
m_vectorPhysicalProperty.reserve(vertexCount);
m_vectorPhysicalProperty.resize(vertexCount);
}
return true;
}
/*****************************************************************************/
/** Sets the ID of the core material thread.
*
* This function sets the ID of the core material thread of the core submesh
* instance.
*
* @param coreMaterialThreadId The ID of the core material thread that should
* be set.
*****************************************************************************/
void CalCoreSubmesh::setCoreMaterialThreadId(int coreMaterialThreadId)
{
m_coreMaterialThreadId = coreMaterialThreadId;
}
/*****************************************************************************/
/** Sets a specified face.
*
* This function sets a specified face in the core submesh instance.
*
* @param faceId The ID of the face.
* @param face The face that should be set.
*
* @return One of the following values:
* \li \b true if successful
* \li \b false if an error happend
*****************************************************************************/
bool CalCoreSubmesh::setFace(int faceId, const Face& face)
{
if((faceId < 0) || (faceId >= (int)m_vectorFace.size())) return false;
m_vectorFace[faceId] = face;
return true;
}
/*****************************************************************************/
/** Sets the number of LOD steps.
*
* This function sets the number of LOD steps of the core submesh instance.
*
* @param lodCount The number of LOD steps that should be set.
*****************************************************************************/
void CalCoreSubmesh::setLodCount(int lodCount)
{
m_lodCount = lodCount;
}
/*****************************************************************************/
/** Sets the tangent vector associated with a specified texture coordinate pair.
*
* This function sets the tangent vector associated with a specified
* texture coordinate pair in the core submesh instance.
*
* @param vertexId The ID of the vertex.
* @param textureCoordinateId The ID of the texture coordinate channel.
* @param tangent The tangent vector that should be stored.
* @param crossFactor The cross-product factor that should be stored.
*
* @return One of the following values:
* \li \b true if successful
* \li \b false if an error happend
*****************************************************************************/
bool CalCoreSubmesh::setTangentSpace(int vertexId, int textureCoordinateId, const CalVector& tangent, float crossFactor)
{
if((vertexId < 0) || (vertexId >= (int)m_vectorVertex.size())) return false;
if((textureCoordinateId < 0) || (textureCoordinateId >= (int)m_vectorvectorTextureCoordinate.size())) return false;
if(!m_vectorTangentsEnabled[textureCoordinateId]) return false;
m_vectorvectorTangentSpace[textureCoordinateId][vertexId].tangent = tangent;
m_vectorvectorTangentSpace[textureCoordinateId][vertexId].crossFactor = crossFactor;
return true;
}
/*****************************************************************************/
/** Sets a specified physical property.
*
* This function sets a specified physical property in the core submesh
* instance.
*
* @param vertexId The ID of the vertex.
* @param physicalProperty The physical property that should be set.
*
* @return One of the following values:
* \li \b true if successful
* \li \b false if an error happend
*****************************************************************************/
bool CalCoreSubmesh::setPhysicalProperty(int vertexId, const PhysicalProperty& physicalProperty)
{
if((vertexId < 0) || (vertexId >= (int)m_vectorPhysicalProperty.size())) return false;
m_vectorPhysicalProperty[vertexId] = physicalProperty;
return true;
}
/*****************************************************************************/
/** Sets a specified spring.
*
* This function sets a specified spring in the core submesh instance.
*
* @param springId The ID of the spring.
* @param spring The spring that should be set.
*
* @return One of the following values:
* \li \b true if successful
* \li \b false if an error happend
*****************************************************************************/
bool CalCoreSubmesh::setSpring(int springId, const Spring& spring)
{
if((springId < 0) || (springId >= (int)m_vectorSpring.size())) return false;
m_vectorSpring[springId] = spring;
return true;
}
/*****************************************************************************/
/** Sets a specified texture coordinate.
*
* This function sets a specified texture coordinate in the core submesh
* instance.
*
* @param vertexId The ID of the vertex.
* @param textureCoordinateId The ID of the texture coordinate.
* @param textureCoordinate The texture coordinate that should be set.
*
* @return One of the following values:
* \li \b true if successful
* \li \b false if an error happend
*****************************************************************************/
bool CalCoreSubmesh::setTextureCoordinate(int vertexId, int textureCoordinateId, const TextureCoordinate& textureCoordinate)
{
if((textureCoordinateId < 0) || (textureCoordinateId >= (int)m_vectorvectorTextureCoordinate.size())) return false;
if((vertexId < 0) || (vertexId >= (int)m_vectorvectorTextureCoordinate[textureCoordinateId].size())) return false;
m_vectorvectorTextureCoordinate[textureCoordinateId][vertexId] = textureCoordinate;
return true;
}
/*****************************************************************************/
/** Sets a specified vertex.
*
* This function sets a specified vertex in the core submesh instance.
*
* @param vertexId The ID of the vertex.
* @param vertex The vertex that should be set.
*
* @return One of the following values:
* \li \b true if successful
* \li \b false if an error happend
*****************************************************************************/
bool CalCoreSubmesh::setVertex(int vertexId, const Vertex& vertex)
{
if((vertexId < 0) || (vertexId >= (int)m_vectorVertex.size())) return false;
m_vectorVertex[vertexId] = vertex;
return true;
}
/*****************************************************************************/
/** Adds a core sub morph target.
*
* This function adds a core sub morph target to the core sub mesh instance.
*
* @param pCoreSubMorphTarget A pointer to the core sub morph target that should be added.
*
* @return One of the following values:
* \li the assigned sub morph target \b ID of the added core sub morph target
* \li \b -1 if an error happend
*****************************************************************************/
int CalCoreSubmesh::addCoreSubMorphTarget(CalCoreSubMorphTarget *pCoreSubMorphTarget)
{
// get next sub morph target id
int subMorphTargetId;
subMorphTargetId = m_vectorCoreSubMorphTarget.size();
m_vectorCoreSubMorphTarget.push_back(pCoreSubMorphTarget);
return subMorphTargetId;
}
/*****************************************************************************/
/** Provides access to a core sub morph target.
*
* This function returns the core sub morph target with the given ID.
*
* @param id The ID of the core sub morph target that should be returned.
*
* @return One of the following values:
* \li a pointer to the core sub morph target
* \li \b 0 if an error happend
*****************************************************************************/
CalCoreSubMorphTarget *CalCoreSubmesh::getCoreSubMorphTarget(int id)
{
if((id < 0) || (id >= (int)m_vectorCoreSubMorphTarget.size()))
{
return 0;
}
return m_vectorCoreSubMorphTarget[id];
}
/*****************************************************************************/
/** Returns the number of core sub morph targets.
*
* This function returns the number of core sub morph targets in the core sub mesh
* instance.
*
* @return The number of core sub morph targets.
*****************************************************************************/
int CalCoreSubmesh::getCoreSubMorphTargetCount()
{
return m_vectorCoreSubMorphTarget.size();
}
/*****************************************************************************/
/** Returns the core sub morph target vector.
*
* This function returns the vector that contains all core sub morph target
* of the core submesh instance.
*
* @return A reference to the core sub morph target vector.
*****************************************************************************/
std::vector<CalCoreSubMorphTarget *>& CalCoreSubmesh::getVectorCoreSubMorphTarget()
{
return m_vectorCoreSubMorphTarget;
}
/*****************************************************************************/
/** Scale the Submesh.
*
* This function rescale all the data that are in the core submesh instance.
*
* @param factor A float with the scale factor
*
*****************************************************************************/
void CalCoreSubmesh::scale(float factor)
{
// rescale all vertices
for(size_t vertexId = 0; vertexId < m_vectorVertex.size() ; vertexId++)
{
m_vectorVertex[vertexId].position*=factor;
}
if(!m_vectorSpring.empty())
{
// There is a problem when we resize and that there is
// a spring system, I was unable to solve this
// problem, so I disable the spring system
// if the scale are too big
if( fabs(factor - 1.0f) > 0.10)
{
m_vectorSpring.clear();
m_vectorPhysicalProperty.clear();
}
/*
for(vertexId = 0; vertexId < m_vectorVertex.size() ; vertexId++)
{
//m_vectorPhysicalProperty[vertexId].weight *= factor;
m_vectorPhysicalProperty[vertexId].weight *= factor*factor;
//m_vectorPhysicalProperty[vertexId].weight *= 0.5f;
}
int springId;
for(springId = 0; springId < m_vectorVertex.size() ; springId++)
{
//m_vectorSpring[springId].idleLength*=factor;
CalVector distance = m_vectorVertex[m_vectorSpring[springId].vertexId[1]].position - m_vectorVertex[m_vectorSpring[springId].vertexId[0]].position;
m_vectorSpring[springId].idleLength = distance.length();
}
*/
}
}
//****************************************************************************//