htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

htrdr_geometry.h (3770B)


      1 /* Copyright (C) 2018-2019, 2022-2025 Centre National de la Recherche Scientifique
      2  * Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux
      3  * Copyright (C) 2022-2025 Institut Pierre-Simon Laplace
      4  * Copyright (C) 2022-2025 Institut de Physique du Globe de Paris
      5  * Copyright (C) 2018-2025 |Méso|Star> (contact@meso-star.com)
      6  * Copyright (C) 2022-2025 Observatoire de Paris
      7  * Copyright (C) 2022-2025 Université de Reims Champagne-Ardenne
      8  * Copyright (C) 2022-2025 Université de Versaille Saint-Quentin
      9  * Copyright (C) 2018-2019, 2022-2025 Université Paul Sabatier
     10  *
     11  * This program is free software: you can redistribute it and/or modify
     12  * it under the terms of the GNU General Public License as published by
     13  * the Free Software Foundation, either version 3 of the License, or
     14  * (at your option) any later version.
     15  *
     16  * This program is distributed in the hope that it will be useful,
     17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     19  * GNU General Public License for more details.
     20  *
     21  * You should have received a copy of the GNU General Public License
     22  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     23 
     24 #ifndef HTRDR_GEOMETRY_H
     25 #define HTRDR_GEOMETRY_H
     26 
     27 #include "core/htrdr.h"
     28 
     29 #include <star/s3d.h>
     30 
     31 /* Forware declarations */
     32 struct htrdr;
     33 struct htrdr_geometry;
     34 struct htrdr_interface;
     35 struct htrdr_materials;
     36 struct s3d_hit;
     37 struct ssf_bsdf;
     38 
     39 struct htrdr_geometry_trace_ray_args {
     40   double ray_org[3];
     41   double ray_dir[3];
     42   double ray_range[2];
     43   struct s3d_hit hit_from; /* Hit from which the ray starts */
     44   s3d_hit_filter_function_T filter; /* NULL <=> no user defined filter */
     45   void* filter_context;
     46 };
     47 
     48 #define HTRDR_GEOMETRY_TRACE_RAY_ARGS_NULL__ {                                 \
     49   {0,0,0}, /* Ray origin */                                                    \
     50   {0,0,1}, /* Ray direction */                                                 \
     51   {0,DBL_MAX}, /* Ray range */                                                 \
     52   S3D_HIT_NULL__, /* Hit from */                                               \
     53   NULL, /* User defined filter function */                                     \
     54   NULL /* User filter function */                                              \
     55 }
     56 static const struct htrdr_geometry_trace_ray_args
     57 HTRDR_GEOMETRY_TRACE_RAY_ARGS_NULL = HTRDR_GEOMETRY_TRACE_RAY_ARGS_NULL__;
     58 
     59 BEGIN_DECLS
     60 
     61 HTRDR_API res_T
     62 htrdr_geometry_create
     63   (struct htrdr* htrdr,
     64    const char* obj_filename,
     65    struct htrdr_materials* mats, /* Library of materials */
     66    struct htrdr_geometry** geometry);
     67 
     68 HTRDR_API void
     69 htrdr_geometry_ref_get
     70   (struct htrdr_geometry* geom);
     71 
     72 HTRDR_API void
     73 htrdr_geometry_ref_put
     74   (struct htrdr_geometry* geom);
     75 
     76 HTRDR_API void
     77 htrdr_geometry_get_interface
     78   (struct htrdr_geometry* geom,
     79    const struct s3d_hit* hit,
     80    struct htrdr_interface* interface);
     81 
     82 HTRDR_API void
     83 htrdr_geometry_get_hit_position
     84   (const struct htrdr_geometry* geom,
     85    const struct s3d_hit* hit,
     86    double position[3]);
     87 
     88 HTRDR_API res_T
     89 htrdr_geometry_trace_ray
     90   (struct htrdr_geometry* geom,
     91    const struct htrdr_geometry_trace_ray_args* args,
     92    struct s3d_hit* hit);
     93 
     94 HTRDR_API res_T
     95 htrdr_geometry_find_closest_point
     96   (struct htrdr_geometry* geom,
     97    const double position[3],
     98    const double radius,
     99    struct s3d_hit* hit);
    100 
    101 HTRDR_API void
    102 htrdr_geometry_get_aabb
    103   (const struct htrdr_geometry* geom,
    104    double lower[3],
    105    double upper[3]);
    106 
    107 /* Empirical value relative to the extent of the geometry that represents the
    108  * threshold below which a numerical problem could occur. */
    109 HTRDR_API double
    110 htrdr_geometry_get_epsilon
    111   (const struct htrdr_geometry* geom);
    112 
    113 END_DECLS
    114 
    115 #endif /* HTRDR_GEOMETRY_H */
    116