mirror of
https://github.com/mcneel/opennurbs.git
synced 2026-03-17 14:56:02 +08:00
Update source to v6.14.19098.19271
This commit is contained in:
@@ -755,335 +755,6 @@ bool ON_SubDMatrix::EvaluateCosAndSin(
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
static
|
||||
unsigned int GetQuadSmoothLevFromCache(
|
||||
unsigned int F, // sector face count
|
||||
size_t LPev_capacity,
|
||||
double* LPev,
|
||||
size_t LT0ev_capacity,
|
||||
double* LT0ev,
|
||||
size_t LT1ev_capacity,
|
||||
double* LT1ev
|
||||
)
|
||||
{
|
||||
// High precision LT0ev coefficients for 3 <= F <= 15
|
||||
// "static" is important for performance and minimal stack use.
|
||||
static const double LT0cache[247] = {
|
||||
0, 0.86602540378443864676, 0, -0.86602540378443864676,
|
||||
3.7839351485861304728, 0, -3.7839351485861304728, 0,
|
||||
1.0000000000000000000, 1.0000000000000000000, 0,
|
||||
-1.0000000000000000000, -1.0000000000000000000,
|
||||
-1.0000000000000000000, 0, 1.0000000000000000000, 0,
|
||||
0.95105651629515357212, 0.87872622515830928074,
|
||||
0.58778525229247312917, 0, -0.58778525229247312917,
|
||||
-0.87872622515830928074, -0.95105651629515357212,
|
||||
-0.54308267395372808534, 0, 0.54308267395372808534, 0,
|
||||
0.86602540378443864676, 0.77709852745195996865,
|
||||
0.86602540378443864676, 0.38854926372597998433, 0,
|
||||
-0.38854926372597998433, -0.86602540378443864676,
|
||||
-0.77709852745195996865, -0.86602540378443864676,
|
||||
-0.38854926372597998433, 0, 0.38854926372597998433, 0,
|
||||
0.78183148246802980871, 0.68971219669360492516,
|
||||
0.97492791218182360702, 0.55310623737345078177,
|
||||
0.43388373911755812048, 0, -0.43388373911755812048,
|
||||
-0.55310623737345078177, -0.97492791218182360702,
|
||||
-0.68971219669360492516, -0.78183148246802980871,
|
||||
-0.30695080433864438319, 0, 0.30695080433864438319, 0,
|
||||
0.70710678118654752440, 0.61678125730815119369,
|
||||
1.0000000000000000000, 0.61678125730815119369,
|
||||
0.70710678118654752440, 0.25547916179456587087, 0,
|
||||
-0.25547916179456587087, -0.70710678118654752440,
|
||||
-0.61678125730815119369, -1.0000000000000000000,
|
||||
-0.61678125730815119369, -0.70710678118654752440,
|
||||
-0.25547916179456587087, 0, 0.25547916179456587087, 0,
|
||||
0.64278760968653932632, 0.55622544001433811680,
|
||||
0.98480775301220805937, 0.63251623261284041596,
|
||||
0.86602540378443864676, 0.41284565033689650257,
|
||||
0.34202014332566873304, 0, -0.34202014332566873304,
|
||||
-0.41284565033689650257, -0.86602540378443864676,
|
||||
-0.63251623261284041596, -0.98480775301220805937,
|
||||
-0.55622544001433811680, -0.64278760968653932632,
|
||||
-0.21967058227594391339, 0, 0.21967058227594391339, 0,
|
||||
0.58778525229247312917, 0.50566567125052178998,
|
||||
0.95105651629515357212, 0.62503714355370602145,
|
||||
0.95105651629515357212, 0.50566567125052178998,
|
||||
0.58778525229247312917, 0.19314709947366877925, 0,
|
||||
-0.19314709947366877925, -0.58778525229247312917,
|
||||
-0.50566567125052178998, -0.95105651629515357212,
|
||||
-0.62503714355370602145, -0.95105651629515357212,
|
||||
-0.50566567125052178998, -0.58778525229247312917,
|
||||
-0.19314709947366877925, 0, 0.19314709947366877925, 0,
|
||||
0.54064081745559758211, 0.46306074794954127410,
|
||||
0.90963199535451837141, 0.60648060252697850912,
|
||||
0.98982144188093273238, 0.55734715098926683027,
|
||||
0.75574957435425828377, 0.33125991703925043383,
|
||||
0.28173255684142969771, 0, -0.28173255684142969771,
|
||||
-0.33125991703925043383, -0.75574957435425828377,
|
||||
-0.55734715098926683027, -0.98982144188093273238,
|
||||
-0.60648060252697850912, -0.90963199535451837141,
|
||||
-0.46306074794954127410, -0.54064081745559758211,
|
||||
-0.17262237772902294759, 0, 0.17262237772902294759, 0,
|
||||
0.50000000000000000000, 0.42679488752454714383,
|
||||
0.86602540378443864676, 0.58301265856385358856,
|
||||
1.0000000000000000000, 0.58301265856385358856,
|
||||
0.86602540378443864676, 0.42679488752454714383,
|
||||
0.50000000000000000000, 0.15621777103930644473, 0,
|
||||
-0.15621777103930644473, -0.50000000000000000000,
|
||||
-0.42679488752454714383, -0.86602540378443864676,
|
||||
-0.58301265856385358856, -1.0000000000000000000,
|
||||
-0.58301265856385358856, -0.86602540378443864676,
|
||||
-0.42679488752454714383, -0.50000000000000000000,
|
||||
-0.15621777103930644473, 0, 0.15621777103930644473, 0,
|
||||
0.46472317204376854566, 0.39561924119941590595,
|
||||
0.82298386589365639458, 0.55783106163446715155,
|
||||
0.99270887409805399280, 0.59225050844211620747,
|
||||
0.93501624268541482344, 0.49099250115803095369,
|
||||
0.66312265824079520238, 0.27725402895972208383,
|
||||
0.23931566428755776715, 0, -0.23931566428755776715,
|
||||
-0.27725402895972208383, -0.66312265824079520238,
|
||||
-0.49099250115803095369, -0.93501624268541482344,
|
||||
-0.59225050844211620747, -0.99270887409805399280,
|
||||
-0.55783106163446715155, -0.82298386589365639458,
|
||||
-0.39561924119941590595, -0.46472317204376854566,
|
||||
-0.14277582033427973597, 0, 0.14277582033427973597, 0,
|
||||
0.43388373911755812048, 0.36857162184070541924,
|
||||
0.78183148246802980871, 0.53260142488428001573,
|
||||
0.97492791218182360702, 0.59114298380170474948,
|
||||
0.97492791218182360702, 0.53260142488428001573,
|
||||
0.78183148246802980871, 0.36857162184070541924,
|
||||
0.43388373911755812048, 0.13154168885727777825, 0,
|
||||
-0.13154168885727777825, -0.43388373911755812048,
|
||||
-0.36857162184070541924, -0.78183148246802980871,
|
||||
-0.53260142488428001573, -0.97492791218182360702,
|
||||
-0.59114298380170474948, -0.97492791218182360702,
|
||||
-0.53260142488428001573, -0.78183148246802980871,
|
||||
-0.36857162184070541924, -0.43388373911755812048,
|
||||
-0.13154168885727777825, 0, 0.13154168885727777825, 0,
|
||||
0.40673664307580020775, 0.34490678248944930474,
|
||||
0.74314482547739423501, 0.50817545082738690904,
|
||||
0.95105651629515357212, 0.58357596708823109868,
|
||||
0.99452189536827333692, 0.55807089701829604578,
|
||||
0.86602540378443864676, 0.43607029893896101468,
|
||||
0.58778525229247312917, 0.23866918459878179394,
|
||||
0.20791169081775933710, 0, -0.20791169081775933710,
|
||||
-0.23866918459878179394, -0.58778525229247312917,
|
||||
-0.43607029893896101468, -0.86602540378443864676,
|
||||
-0.55807089701829604578, -0.99452189536827333692,
|
||||
-0.58357596708823109868, -0.95105651629515357212,
|
||||
-0.50817545082738690904, -0.74314482547739423501,
|
||||
-0.34490678248944930474, -0.40673664307580020775,
|
||||
-0.12200059807933503110, 0, 0.12200059807933503110
|
||||
};
|
||||
|
||||
|
||||
// High precision LT1ev coefficients for 3 <= F <= 15
|
||||
// "static" is important for performance and minimal stack use.
|
||||
static const double LT1cache[sizeof(LT0cache) / sizeof(LT0cache[0])] = {
|
||||
0, 0.50000000000000000000, -4.3693119532645779871,
|
||||
0.50000000000000000000, 2.1846559766322889935,
|
||||
-1.0000000000000000000, 2.1846559766322889935, 0, 0,
|
||||
1.0000000000000000000, 1.0000000000000000000, 1.0000000000000000000,
|
||||
0, -1.0000000000000000000, -1.0000000000000000000,
|
||||
-1.0000000000000000000, 0, -0.30901699437494742410,
|
||||
0.28551545815032630017, 0.80901699437494742410,
|
||||
0.92394743120145227623, 0.80901699437494742410,
|
||||
0.28551545815032630017, -0.30901699437494742410,
|
||||
-0.74748917375105243829, -1.0000000000000000000,
|
||||
-0.74748917375105243829, 0, -0.50000000000000000000, 0,
|
||||
0.50000000000000000000, 0.67298706601687631227,
|
||||
1.0000000000000000000, 0.67298706601687631227,
|
||||
0.50000000000000000000, 0, -0.50000000000000000000,
|
||||
-0.67298706601687631227, -1.0000000000000000000,
|
||||
-0.67298706601687631227, 0, -0.62348980185873353053,
|
||||
-0.15742230810261087253, 0.22252093395631440429,
|
||||
0.44108750553020115113, 0.90096886790241912624,
|
||||
0.70744943095338716474, 0.90096886790241912624,
|
||||
0.44108750553020115113, 0.22252093395631440429,
|
||||
-0.15742230810261087253, -0.62348980185873353053,
|
||||
-0.63738991290428386096, -1.0000000000000000000,
|
||||
-0.63738991290428386096, 0, -0.70710678118654752440,
|
||||
-0.25547916179456587087, 0, 0.25547916179456587087,
|
||||
0.70710678118654752440, 0.61678125730815119369,
|
||||
1.0000000000000000000, 0.61678125730815119369,
|
||||
0.70710678118654752440, 0.25547916179456587087, 0,
|
||||
-0.25547916179456587087, -0.70710678118654752440,
|
||||
-0.61678125730815119369, -1.0000000000000000000,
|
||||
-0.61678125730815119369, 0, -0.76604444311897803520,
|
||||
-0.32113690752239614989, -0.17364817766693034885,
|
||||
0.11152967754571525573, 0.50000000000000000000,
|
||||
0.49201028697588941391, 0.93969262078590838405,
|
||||
0.64227381504479229978, 0.93969262078590838405,
|
||||
0.49201028697588941391, 0.50000000000000000000,
|
||||
0.11152967754571525573, -0.17364817766693034885,
|
||||
-0.32113690752239614989, -0.76604444311897803520,
|
||||
-0.60353996452160466964, -1.0000000000000000000,
|
||||
-0.60353996452160466964, 0, -0.80901699437494742410,
|
||||
-0.36738761511588183857, -0.30901699437494742410, 0,
|
||||
0.30901699437494742410, 0.36738761511588183857,
|
||||
0.80901699437494742410, 0.59444564830326145327,
|
||||
1.0000000000000000000, 0.59444564830326145327,
|
||||
0.80901699437494742410, 0.36738761511588183857,
|
||||
0.30901699437494742410, 0, -0.30901699437494742410,
|
||||
-0.36738761511588183857, -0.80901699437494742410,
|
||||
-0.59444564830326145327, -1.0000000000000000000,
|
||||
-0.59444564830326145327, 0, -0.84125353283118116886,
|
||||
-0.40124442216535750795, -0.41541501300188642553,
|
||||
-0.087198746372372473079, 0.14231483827328514044,
|
||||
0.25453191527694053569, 0.65486073394528506406,
|
||||
0.51545049226239871039, 0.95949297361449738989,
|
||||
0.61271717995368812142, 0.95949297361449738989,
|
||||
0.51545049226239871039, 0.65486073394528506406,
|
||||
0.25453191527694053569, 0.14231483827328514044,
|
||||
-0.087198746372372473079, -0.41541501300188642553,
|
||||
-0.40124442216535750795, -0.84125353283118116886,
|
||||
-0.58789782897845332576, -1.0000000000000000000,
|
||||
-0.58789782897845332576, 0, -0.86602540378443864676,
|
||||
-0.42679488752454714383, -0.50000000000000000000,
|
||||
-0.15621777103930644473, 0, 0.15621777103930644473,
|
||||
0.50000000000000000000, 0.42679488752454714383,
|
||||
0.86602540378443864676, 0.58301265856385358856,
|
||||
1.0000000000000000000, 0.58301265856385358856,
|
||||
0.86602540378443864676, 0.42679488752454714383,
|
||||
0.50000000000000000000, 0.15621777103930644473, 0,
|
||||
-0.15621777103930644473, -0.50000000000000000000,
|
||||
-0.42679488752454714383, -0.86602540378443864676,
|
||||
-0.58301265856385358856, -1.0000000000000000000,
|
||||
-0.58301265856385358856, 0, -0.88545602565320989590,
|
||||
-0.44656180955519116409, -0.56806474673115580251,
|
||||
-0.21155741640550385622, -0.12053668025532305335,
|
||||
0.071912231299433902890, 0.35460488704253562597,
|
||||
0.33890765345000607527, 0.74851074817110109863,
|
||||
0.52826341647516159444, 0.97094181742605202716,
|
||||
0.59660039705015990059, 0.97094181742605202716,
|
||||
0.52826341647516159444, 0.74851074817110109863,
|
||||
0.33890765345000607527, 0.35460488704253562597,
|
||||
0.071912231299433902890, -0.12053668025532305335,
|
||||
-0.21155741640550385622, -0.56806474673115580251,
|
||||
-0.44656180955519116409, -0.88545602565320989590,
|
||||
-0.57926427378898650258, -1.0000000000000000000,
|
||||
-0.57926427378898650258, 0, -0.90096886790241912624,
|
||||
-0.46217419537626135604, -0.62348980185873353053,
|
||||
-0.25648732816499374939, -0.22252093395631440429, 0,
|
||||
0.22252093395631440429, 0.25648732816499374939,
|
||||
0.62348980185873353053, 0.46217419537626135604,
|
||||
0.90096886790241912624, 0.57632179499872958303,
|
||||
1.0000000000000000000, 0.57632179499872958303,
|
||||
0.90096886790241912624, 0.46217419537626135604,
|
||||
0.62348980185873353053, 0.25648732816499374939,
|
||||
0.22252093395631440429, 0, -0.22252093395631440429,
|
||||
-0.25648732816499374939, -0.62348980185873353053,
|
||||
-0.46217419537626135604, -0.90096886790241912624,
|
||||
-0.57632179499872958303, -1.0000000000000000000,
|
||||
-0.57632179499872958303, 0, -0.91354545764260089550,
|
||||
-0.47472345966636156286, -0.66913060635885821383,
|
||||
-0.29339523333075126287, -0.30901699437494742410,
|
||||
-0.061336305740236105673, 0.10452846326765347140,
|
||||
0.18132822633561029999, 0.50000000000000000000,
|
||||
0.39263946076280856068, 0.80901699437494742410,
|
||||
0.53605976540659766854, 0.97814760073380563793,
|
||||
0.58679046666150252574, 0.97814760073380563793,
|
||||
0.53605976540659766854, 0.80901699437494742410,
|
||||
0.39263946076280856068, 0.50000000000000000000,
|
||||
0.18132822633561029999, 0.10452846326765347140,
|
||||
-0.061336305740236105673, -0.30901699437494742410,
|
||||
-0.29339523333075126287, -0.66913060635885821383,
|
||||
-0.47472345966636156286, -0.91354545764260089550,
|
||||
-0.57396768709841886067, -1.0000000000000000000,
|
||||
-0.57396768709841886067};
|
||||
|
||||
|
||||
if (F < 2)
|
||||
return ON_SUBD_RETURN_ERROR(0);
|
||||
|
||||
const unsigned int R = 1 + 2 * F;
|
||||
|
||||
if (nullptr != LPev)
|
||||
{
|
||||
// In this case, LPev values are calculated accurately using double precision arithmetic.
|
||||
// Lpev[]
|
||||
const double f = F;
|
||||
LPev[0] = f / (5.0 + f); // center point coefficient
|
||||
const double y = f*(f + 5.0);
|
||||
const double p = 4.0 / y; // edge point coefficient
|
||||
const double q = 1.0 / y; // face point coefficient
|
||||
for (unsigned int i = 1; i < R; i++)
|
||||
{
|
||||
LPev[i] = p;
|
||||
i++;
|
||||
LPev[i] = q;
|
||||
}
|
||||
}
|
||||
|
||||
if (nullptr != LT0ev || nullptr != LT1ev)
|
||||
{
|
||||
if (2 == F)
|
||||
{
|
||||
if (nullptr != LT1ev)
|
||||
{
|
||||
for (unsigned int i = 0; i < R; i++)
|
||||
LT0ev[i] = 0.0;
|
||||
}
|
||||
if (nullptr != LT1ev)
|
||||
{
|
||||
for (unsigned int i = 0; i < R; i++)
|
||||
LT1ev[i] = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (F > 15)
|
||||
return 0; // not an error
|
||||
|
||||
const unsigned int R = 1 + 2 * F;
|
||||
|
||||
if (R > LPev_capacity || R > LT0ev_capacity || R > LT1ev_capacity)
|
||||
return ON_SUBD_RETURN_ERROR(0);
|
||||
|
||||
const unsigned int cache_capacity = (unsigned int)(sizeof(LT0cache) / sizeof(LT0cache[0]));
|
||||
const unsigned int cache_offset = (F - 3)*(F + 3);
|
||||
if (cache_capacity < cache_offset + R)
|
||||
{
|
||||
// cached values are damaged.
|
||||
return ON_SUBD_RETURN_ERROR(0);
|
||||
}
|
||||
|
||||
const double* LT0src = LT0cache + cache_offset;
|
||||
const double* LT1src = LT1cache + cache_offset;
|
||||
|
||||
if (0.0 != LT0src[0] || 0.0 != LT1src[0])
|
||||
{
|
||||
// cached values are damaged.
|
||||
return ON_SUBD_RETURN_ERROR(0);
|
||||
}
|
||||
|
||||
if (nullptr != LT0ev && nullptr != LT1ev)
|
||||
{
|
||||
for (unsigned int i = 0; i < R; i++)
|
||||
{
|
||||
LT0ev[i] = LT0src[i];
|
||||
LT1ev[i] = LT1src[i];
|
||||
}
|
||||
}
|
||||
else if (nullptr != LT0ev)
|
||||
{
|
||||
for (unsigned int i = 0; i < R; i++)
|
||||
LT0ev[i] = LT0src[i];
|
||||
}
|
||||
else if (nullptr != LT1ev)
|
||||
{
|
||||
for (unsigned int i = 0; i < R; i++)
|
||||
LT1ev[i] = LT1src[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return R;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
unsigned int ON_SubDSectorType::GetSubdivisionMatrix(
|
||||
size_t S_capacity,
|
||||
@@ -2467,10 +2138,9 @@ const ON_SubDMatrix& ON_SubDMatrix::FromCache(
|
||||
ON_SubDSectorType sector_type
|
||||
)
|
||||
{
|
||||
#if defined(OPENNURBS_SLEEPLOCK_AVAILABLE)
|
||||
// The ON_SubDMatrix cache is a global resource for the entire application.
|
||||
// This is a thread safe function that manages the ON_SubDMatrix cache.
|
||||
static ON_SleepLock lock;
|
||||
#endif
|
||||
|
||||
// The sector_type.Hash() is used to find elements in the cache.
|
||||
static ON_SubDMatrixHashElement* hash_table[256] = { 0 };
|
||||
@@ -2490,12 +2160,10 @@ const ON_SubDMatrix& ON_SubDMatrix::FromCache(
|
||||
|
||||
// We need to add this case to the cache.
|
||||
|
||||
#if defined(OPENNURBS_SLEEPLOCK_AVAILABLE)
|
||||
// Lock the cache
|
||||
bool bReturnLock = lock.GetLock(0,ON_SleepLock::ThirtySeconds);
|
||||
bool bReturnLock = lock.GetLock(0,30*ON_SleepLock::OneSecond);
|
||||
if (false == bReturnLock)
|
||||
bReturnLock = lock.GetLock(0, ON_SleepLock::OneSecond);
|
||||
#endif
|
||||
|
||||
// see if another thread made the sector matrix while we waited
|
||||
hash_element = FindMatrixHashElement(sector_type,hash_table[hash_index]);
|
||||
@@ -2553,11 +2221,9 @@ const ON_SubDMatrix& ON_SubDMatrix::FromCache(
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OPENNURBS_SLEEPLOCK_AVAILABLE)
|
||||
// Unlock the cache
|
||||
if (bReturnLock)
|
||||
lock.ReturnLock();
|
||||
#endif
|
||||
|
||||
if ( nullptr != hash_element )
|
||||
return hash_element->m_sm;
|
||||
|
||||
Reference in New Issue
Block a user