FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
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 */
14double HECMW_degree_to_radian(double deg) { return deg * HECMW_PI / 180; }
15
16/* Radian to Degree Transformation */
17double 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}
double HECMW_radian_to_degree(double rad)
int HECMW_cylindrical_to_cartesian(const struct hecmw_coord *coord, struct hecmw_coord *result)
#define HECMW_PI
double HECMW_degree_to_radian(double deg)
#define NULL