summaryrefslogtreecommitdiff
path: root/src/Xw/Xw_calc_points.cxx
blob: 9c14b3359f27379562d269e233c3fb032b3a200c (plain)
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
// File:	Xw_points.cxx
// Created:	Wed Feb 20 17:50:06 2002
// Author:	Sergey ALTUKHOV
//		<sav@vovox>

#include <Standard_Integer.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Xw_Extension.h>


#ifdef XW_PROTOTYPE
int PXPOINT( double x, double ratio )
#else
int PXPOINT( x, ratio )
double x, ratio;
#endif /*XW_PROTOTYPE*/
{
  int result = 0;
  try {
    OCC_CATCH_SIGNALS
    result = (int) ( x / ratio );
  }
  catch (Standard_Failure) {
    result = ROUND( x / ratio );
  }
  return result;
}


#ifdef XW_PROTOTYPE
int PYPOINT( double y, double height, double ratio )
#else
int PYPOINT( y, height, ratio )
double y, height, ratio;
#endif /*XW_PROTOTYPE*/
{
  int result = 0;
  try {
    OCC_CATCH_SIGNALS
    result = (int)( height - ( y / ratio ) );
  }
  catch (Standard_Failure) {
    result = ROUND( height - ( y / ratio ) );
  }
  return result;
}


#ifdef XW_PROTOTYPE
int PVALUE( double v, double xratio, double yratio )
#else
int PVALUE( v, xratio, yratio )
double v, xratio, yratio;
#endif /*XW_PROTOTYPE*/
{
  int result = 0;
  try {
    OCC_CATCH_SIGNALS
    result = (int)( v / ( ( xratio + yratio ) / 2. ) );
  }
  catch (Standard_Failure) {
    result = ROUND( v / ( ( xratio + yratio ) / 2. ) );
  }
  return result;
}