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
//- Class: PlanarParamTool<--- Skipping configuration 'ACIS' since the value of 'ACIS' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.<--- Skipping configuration 'DBL_MAX' since the value of 'DBL_MAX' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.<--- Skipping configuration 'DBL_MIN' since the value of 'DBL_MIN' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.<--- Skipping configuration 'M_PI' since the value of 'M_PI' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
//-------------------------------------------------------------------------
// Filename      : PlanarParamTool.cpp
//
// Purpose       : Surface Parameterization for mesh by triangulation flattening
//
// Creator       : Christopher Hynes
//
// Creation Date : 7/10/2002
//
// Owner         : Christopher Hynes
//-------------------------------------------------------------------------

#include "PlanarParamTool.hpp"
#include "CastTo.hpp"
#include "GeometryDefines.h"


//-------------------------------------------------------------------------
// Function:    PlanarParamTool
// Description: constructor
// Author:      chynes
// Date:        7/10/2002
//-------------------------------------------------------------------------
PlanarParamTool::PlanarParamTool()
{
}

//-------------------------------------------------------------------------
// Function:    PlanarParamTool
// Description: deconstructor
// Author:      chynes
// Date:        7/10/2002
//-------------------------------------------------------------------------
PlanarParamTool::~PlanarParamTool() {}

//===================================================================================
// Function: set_up_space (Public)
// Description: sets up space of flattening
// Author: chynes
// Date: 7/10/02
//===================================================================================
CubitStatus PlanarParamTool::set_up_space(CubitVector& du, CubitVector& dv, CubitVector& uv_center)
{
        Du = du;
        Dv = dv;
        uvCenter = uv_center;

	return CUBIT_SUCCESS; 
}

//===================================================================================
// Function: transform_to_uv (Public)
// Description: same as title
// Author: chynes
// Date: 7/10/02
//===================================================================================
CubitStatus PlanarParamTool::transform_to_uv(const CubitVector &xyz_location, CubitVector &uv_location) 
{
  // Translate to local origin at center

  CubitVector vect = xyz_location - uvCenter;

   // Multiply by transpose (inverse) of transformation vector

  uv_location.x( vect % Du );
  uv_location.y( vect % Dv );
  uv_location.z( 0.0 );

  return CUBIT_SUCCESS;
}

//===================================================================================
// Function: transform_to_xyz (Public)
// Description: same as title
// Author: chynes
// Date: 7/10/02
//===================================================================================
CubitStatus PlanarParamTool::transform_to_xyz(CubitVector &xyz_location, const CubitVector &uv_location) 
{
// Multiply by transformation matrix

  CubitVector vect;
  vect.x( uv_location.x() * Du.x() +
          uv_location.y() * Dv.x() );
  vect.y( uv_location.x() * Du.y() +
          uv_location.y() * Dv.y() );
  vect.z( uv_location.x() * Du.z() +
          uv_location.y() * Dv.z() );

   // Translate from origin

  xyz_location = vect + uvCenter;

  return CUBIT_SUCCESS;
}

CubitStatus PlanarParamTool::uv_derivitives( double u_param, double v_param, 
                        		                 CubitVector &du, CubitVector &dv )
{
  (void)u_param;
  (void)v_param;
  du = Du;
  dv = Dv;
  return CUBIT_SUCCESS;
}

//EOF