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 | //- Class: PeriodicParamTool
//-------------------------------------------------------------------------
// Filename : PeriodicParamTool.cpp
//
// Purpose : Handles surfaces that have a periodic parameterization
// Uses, but modifies, the underlying engine parameterization
//
//
// Creator : Ray J. Meyers
//
// Creation Date : 12/15/2008
//
// Owner : Ray J. Meyers
//-------------------------------------------------------------------------
#include "PeriodicParamTool.hpp"
//#include "CastTo.hpp"
#include "Surface.hpp"
#include "CubitMessage.hpp"
//#include "DLIList.hpp"
//-------------------------------------------------------------------------
// Function: PeriodicParamTool
// Description: constructor
// Author: chynes
// Date: 7/10/2002
//-------------------------------------------------------------------------
PeriodicParamTool::PeriodicParamTool(Surface *surf)
{
//- update private variables
refSurf = surf;
uOffset = 0.0;
vOffset = 0.0;
uPeriod = 0.0;
vPeriod = 0.0;
mirrorSurface = false;
}
//-------------------------------------------------------------------------
// Function: PeriodicParamTool
// Description: deconstructor
// Author: chynes
// Date: 7/10/2002
//-------------------------------------------------------------------------
PeriodicParamTool::~PeriodicParamTool() {}
//===================================================================================
// Function: set_up_space (Public)
// Description: sets up space of flattening
// Author: chynes
// Date: 7/10/02
//===================================================================================
CubitStatus PeriodicParamTool::set_up_space(double u_period, double v_period, double u_offset, double v_offset)<--- The function 'set_up_space' is never used.
{
// store the u and periods
uPeriod = u_period;
vPeriod = v_period;
uOffset = u_offset;
vOffset = v_offset;
CubitStatus rv = CUBIT_SUCCESS;
return rv;
}
//===================================================================================
// Function: transform_to_uv (Public)
// Description: same as title, the local sizing will be returned in the z coord
// Author: chynes
// Date: 7/10/02
//===================================================================================
CubitStatus PeriodicParamTool::transform_to_uv(const CubitVector &xyz_location, CubitVector &uv_location) <--- The function 'transform_to_uv' is never used.
{
double u,v;
CubitStatus rv = refSurf->u_v_from_position(xyz_location, u, v);
// offset values to avoid parameter discontinuity
if (uPeriod && u < uOffset)
{
u += uPeriod;
}
// mirror surface if required to get correct loop orientation
if (mirrorSurface)
{
u = -u;
}
if (vPeriod && v < vOffset)
{
v += vPeriod;
}
uv_location.set(u,v,1.0);
return rv;
}
//===================================================================================
// Function: transform_to_xyz (Public)
// Description: same as title
// Author: chynes
// Date: 7/10/02
//===================================================================================
CubitStatus PeriodicParamTool::transform_to_xyz(CubitVector &xyz_location, const CubitVector &uv_location)
{
double u = uv_location.x();
if (mirrorSurface)
{
u = -u;
}
if (u > uPeriod)
{
u = u - uPeriod;
}
double v = uv_location.y();
if (v > vPeriod)
{
v = v - vPeriod;
}
xyz_location = refSurf->position_from_u_v(u,v);
return CUBIT_SUCCESS;
}
void PeriodicParamTool::mirror_surface(bool true_false)<--- The function 'mirror_surface' is never used.
{
mirrorSurface = true_false;
if (mirrorSurface)
PRINT_INFO("Loops appear backwards, mirroring surface...\n");
}
CubitStatus PeriodicParamTool::uv_derivitives(double u_param, double v_param,
CubitVector &du, CubitVector &dv)
{
if (mirrorSurface)
u_param = -u_param;
if (u_param > uPeriod)
u_param = u_param-uPeriod;
if (v_param > vPeriod)
v_param = v_param-vPeriod;
refSurf->uv_derivitives(u_param, v_param, du, dv);
return CUBIT_SUCCESS;
}
//EOF
|