FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_geometric.c
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <math.h>
9 #include "hecmw_geometric.h"
10 
11 #define HECMW_PI 3.1415926535897932
12 
13 /* Degree to Radian Transformation */
14 double HECMW_degree_to_radian(double deg) { return deg * HECMW_PI / 180; }
15 
16 /* Radian to Degree Transformation */
17 double HECMW_radian_to_degree(double rad) { return rad * 180 / HECMW_PI; }
18 
20  struct hecmw_coord *result) {
21  double r;
22  double rtheta;
23  double z;
24 
25  if (result == NULL) return -1;
26 
27  r = coord->x;
28  rtheta = coord->y; /* radian */
29  z = coord->z;
30 
31  result->x = r * cos(rtheta);
32  result->y = r * sin(rtheta);
33  result->z = z;
34 
35  return 0;
36 }
hecmw_coord::x
double x
Definition: hecmw_geometric.h:13
hecmw_geometric.h
HECMW_PI
#define HECMW_PI
Definition: hecmw_geometric.c:11
hecmw_coord
Definition: hecmw_geometric.h:9
hecmw_coord::z
double z
Definition: hecmw_geometric.h:15
hecmw_coord::y
double y
Definition: hecmw_geometric.h:14
HECMW_cylindrical_to_cartesian
int HECMW_cylindrical_to_cartesian(const struct hecmw_coord *coord, struct hecmw_coord *result)
Definition: hecmw_geometric.c:19
HECMW_degree_to_radian
double HECMW_degree_to_radian(double deg)
Definition: hecmw_geometric.c:14
NULL
#define NULL
Definition: hecmw_io_nastran.c:30
HECMW_radian_to_degree
double HECMW_radian_to_degree(double rad)
Definition: hecmw_geometric.c:17