2015-03-03 00:38:33 +08:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** GeomIO Library
|
|
|
|
** Copyright FougSys (2 Mar. 2015)
|
|
|
|
** contact@fougsys.fr
|
|
|
|
**
|
|
|
|
** This software is a reusable library whose purpose is to provide complete
|
|
|
|
** I/O support for various CAD file formats (eg. STL)
|
|
|
|
**
|
|
|
|
** This software is governed by the CeCILL-B license under French law and
|
|
|
|
** abiding by the rules of distribution of free software. You can use,
|
|
|
|
** modify and/ or redistribute the software under the terms of the CeCILL-B
|
|
|
|
** license as circulated by CEA, CNRS and INRIA at the following URL
|
|
|
|
** "http://www.cecill.info".
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-03-28 23:33:35 +08:00
|
|
|
#ifndef GMIO_LIBSTL_TRIANGLE_H
|
|
|
|
#define GMIO_LIBSTL_TRIANGLE_H
|
|
|
|
|
|
|
|
#include "stl_global.h"
|
|
|
|
|
2014-11-21 18:39:23 +08:00
|
|
|
/*! \brief Cartesian coordinate entity in 3D space, specifically tailored for
|
|
|
|
* STL needs (single-float)
|
|
|
|
*/
|
2014-03-28 23:33:35 +08:00
|
|
|
struct gmio_stl_coords
|
|
|
|
{
|
2015-03-03 17:35:36 +08:00
|
|
|
gmio_real32_t x;
|
|
|
|
gmio_real32_t y;
|
|
|
|
gmio_real32_t z;
|
2014-03-28 23:33:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct gmio_stl_coords gmio_stl_coords_t;
|
|
|
|
|
2014-11-21 18:39:23 +08:00
|
|
|
/*! \brief STL mesh triangle defined three geometric vertices and an
|
|
|
|
* orientation(normal)
|
|
|
|
*/
|
2014-03-28 23:33:35 +08:00
|
|
|
struct gmio_stl_triangle
|
|
|
|
{
|
2015-03-03 17:35:36 +08:00
|
|
|
gmio_stl_coords_t normal;
|
|
|
|
gmio_stl_coords_t v1;
|
|
|
|
gmio_stl_coords_t v2;
|
|
|
|
gmio_stl_coords_t v3;
|
|
|
|
uint16_t attribute_byte_count; /*!< Useful only for STL binary format */
|
2014-03-28 23:33:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct gmio_stl_triangle gmio_stl_triangle_t;
|
|
|
|
|
|
|
|
/*! Compact size of a gmio_stl_coords_t object */
|
2015-03-02 23:43:42 +08:00
|
|
|
enum { GMIO_STL_COORDS_RAWSIZE = (3 * sizeof(gmio_real32_t)) };
|
2014-03-28 23:33:35 +08:00
|
|
|
|
|
|
|
/*! Compact size of a gmio_stl_triangle_t object for STL ascii format */
|
2015-03-02 23:43:42 +08:00
|
|
|
enum { GMIO_STLA_TRIANGLE_RAWSIZE = (4 * GMIO_STL_COORDS_RAWSIZE) };
|
2014-03-28 23:33:35 +08:00
|
|
|
|
|
|
|
/*! Compact size of a gmio_stl_triangle_t object for STL binary format */
|
2015-03-02 23:43:42 +08:00
|
|
|
enum { GMIO_STLB_TRIANGLE_RAWSIZE = (GMIO_STLA_TRIANGLE_RAWSIZE + sizeof(uint16_t)) };
|
2014-03-28 23:33:35 +08:00
|
|
|
|
|
|
|
#endif /* GMIO_LIBSTL_TRIANGLE_H */
|