Revision: 64327
http://sourceforge.net/p/brlcad/code/64327
Author: indianlarry
Date: 2015-03-02 17:14:38 +0000 (Mon, 02 Mar 2015)
Log Message:
-----------
Cleaned up ON_2dPoint UnwrapUVPoint(const ON_Surface *surf,const ON_2dPoint
&pt, double tol) to better match what is in ON_Surface::UnwrapUV(). Also
cleaned up and moved some calls to this function were they weren't needed.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/PullbackCurve.cpp
Modified: brlcad/trunk/src/libbrep/PullbackCurve.cpp
===================================================================
--- brlcad/trunk/src/libbrep/PullbackCurve.cpp 2015-03-02 16:54:45 UTC (rev
64326)
+++ brlcad/trunk/src/libbrep/PullbackCurve.cpp 2015-03-02 17:14:38 UTC (rev
64327)
@@ -2493,25 +2493,21 @@
UnwrapUVPoint(const ON_Surface *surf,const ON_2dPoint &pt, double tol)
{
ON_2dPoint p = pt;
+
for (int i=0; i<2; i++) {
if (!surf->IsClosed(i))
continue;
- while (p[i] < surf->Domain(i).m_t[0] - tol) {
- double length = surf->Domain(i).Length();
- if (i<=0) {
- p.x = p.x + length;
- } else {
- p.y = p.y + length;
- }
+ double length = surf->Domain(i).Length();
+ double dom_min = surf->Domain(i).Min() - ON_ZERO_TOLERANCE;
+ double dom_max = surf->Domain(i).Max() + ON_ZERO_TOLERANCE;
+
+ if (p[i] < surf->Domain(i).m_t[0] - tol) {
+ int domains_away = (int)(((dom_min - p[i]) / length) + 1.0);
+ p[i] += length*domains_away;
+ } else if (p[i] >= surf->Domain(i).m_t[1] + tol) {
+ int domains_away = (int)(((p[i] - dom_max) / length) + 1.0);
+ p[i] -= length * domains_away;
}
- while (p[i] >= surf->Domain(i).m_t[1] + tol) {
- double length = surf->Domain(i).Length();
- if (i<=0) {
- p.x = p.x - length;
- } else {
- p.y = p.y - length;
- }
- }
}
return p;
@@ -2581,12 +2577,12 @@
* if one of the points is at a seam then not crossing
*/
int dir =0;
- ON_2dPoint unwrapped_pt = UnwrapUVPoint(surf,pt);
- ON_2dPoint unwrapped_prev_pt = UnwrapUVPoint(surf,prev_pt);
if (!IsAtSeam(surf,dir,pt,tol) && !IsAtSeam(surf,dir,prev_pt,tol)) {
udir = vdir = 0;
if (surf->IsClosed(0)) {
+ ON_2dPoint unwrapped_pt = UnwrapUVPoint(surf,pt);
+ ON_2dPoint unwrapped_prev_pt = UnwrapUVPoint(surf,prev_pt);
double delta=unwrapped_pt.x-unwrapped_prev_pt.x;
if (fabs(delta) > surf->Domain(0).Length()/2.0) {
if (delta < 0.0) {
@@ -2601,6 +2597,8 @@
dir = 1;
if (!IsAtSeam(surf,dir,pt,tol) && !IsAtSeam(surf,dir,prev_pt,tol)) {
if (surf->IsClosed(1)) {
+ ON_2dPoint unwrapped_pt = UnwrapUVPoint(surf,pt);
+ ON_2dPoint unwrapped_prev_pt = UnwrapUVPoint(surf,prev_pt);
double delta=unwrapped_pt.y-unwrapped_prev_pt.y;
if (fabs(delta) > surf->Domain(1).Length()/2.0) {
if (delta < 0.0) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits