[admesh] 01/17: Merge new version.

Anton Gladky gladk at moszumanska.debian.org
Fri May 9 21:40:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

gladk pushed a commit to branch master
in repository admesh.

commit 05228d764213a7ede4f79bf71ed3b4efb6ec1045
Merge: cff9d65 171e567
Author: Anton Gladky <gladk at debian.org>
Date:   Fri May 9 21:32:38 2014 +0200

    Merge new version.

 .travis.yml                  |  10 ++
 COPYING                      |  42 ++++----
 ChangeLog => ChangeLog.old   |   0
 INSTALL                      |  14 +++
 Makefile.am                  |  58 ++++++++++
 README => README.md          |  51 ++++++++-
 ADMESH.DOC => admesh-doc.txt |   0
 admesh.1                     |  93 +++++++++++++++++
 autogen.sh                   |   7 ++
 configure.ac                 |  74 +++++++++++++
 libadmesh.pc.in              |  11 ++
 admesh.c => src/admesh.c     | 103 +++++++++++++++---
 connect.c => src/connect.c   |  48 +++++----
 normals.c => src/normals.c   | 109 ++++++++++---------
 shared.c => src/shared.c     |  70 ++++++++++---
 stl.h => src/stl.h           |  50 ++++++---
 stl_io.c => src/stl_io.c     |  50 ++++++---
 stlinit.c => src/stlinit.c   | 244 ++++++++++++++++++++++++++-----------------
 util.c => src/util.c         | 132 +++++++++++++++++------
 19 files changed, 890 insertions(+), 276 deletions(-)

diff --cc INSTALL
index d697e02,f0a50c3..04aef59
--- a/INSTALL
+++ b/INSTALL
@@@ -1,20 -1,14 +1,34 @@@
 -To install ADMesh, you will need a system with a c compiler.
 +To install ADMesh, you will need a system with a c compiler and cmake.
  Do the following:
  
++<<<<<<< HEAD
 +1. Get the file admesh-XXX.tar.gz
 +2. Extract the archive.  i.e. type something like the following:
 +      tar -zxvf admesh-XXX.tar.gz
 +   The source files will be extracted into a directory
 +3. Create build directory:
 +      mkdir build
 +      cd build
 +4. Type the following:
 +      cmake -DCMAKE_INSTALL_PREFIX=/INSTALL_PATH/FOR/ADMESH ./../ADMESH_SRC_DIR
 +      make
 +      make install
 +
 +That should do it.  You should have an executable file called admesh in:  
 +  /INSTALL_PATH/FOR/ADMESH/bin/admesh
 +
 +To regenerate manpage for admesh, use help2man tool:
 +help2man admessh --name="a program for processing triangulated solid meshes" > admesh.1
++=======
+ 1.  Get the file admesh-x.xx.tar.gz
+ 2.  Extract the archive.  i.e. type something like the following:
+          tar -zxvf admesh-x.xx.tar.gz
+     The source files will be extracted into a directory called admesh-x.xx
+ 3.  cd admesh-x.xx
+ 4.  type the following:
+          ./configure
+ 	 make
+ 	 su -c 'make install'
+ 
+ That should do it. Standard options for configure script and make are provided.
++>>>>>>> upstream/0.97.3_git_3518914
diff --cc README.md
index 99b11e4,f6c92a2..bf2f3ba
--- a/README.md
+++ b/README.md
@@@ -1,5 -1,21 +1,26 @@@
++<<<<<<< HEAD:README
 +                     ADMesh version 0.96
 +                    ********************
++=======
+ About this release and repository:
+ ----------------------------------
+ 
+ ADMesh was released as an application in 1995/96. Not much happened since then.
+ As the code of this project might bring use for others, this "fork" was created
+ to provide a shared library. Once done that, I've collected lots of bugfixes
+ from the world around us.
+ 
+ No further development will be done, but bugs will be resolved, if possible.
+ 
+ Don't patch this project downstream but use this code, so all can benefit from
+ the changes. Pull requests are welcome, but be sure to generate no warnings.
+ 
+ Grab the 0.97.3 tarball:
+ https://github.com/admesh/admesh/releases/download/v0.97.3/admesh-0.97.3.tar.gz
+ 
+ About ADMesh:
+ -------------
++>>>>>>> upstream/0.97.3_git_3518914:README.md
  
  ADMesh is a program for processing triangulated solid meshes. Currently,
  ADMesh only reads the STL file format that is used for rapid prototyping
@@@ -25,12 -46,13 +51,20 @@@ Features
   * Write a DXF file 
   * Calculate the volume of a part
  
-  ** ADMesh outputs the following statistics after processing:
+ ADMesh outputs the following statistics after processing:
  
++<<<<<<< HEAD:README
 +================= Results produced by ADMesh version 0.96 =================
 +Input file         : sphere.stl
 +File type          : Binary STL file
 +Header             : Processed by ADMesh version 0.96
++=======
+ ````
+ ================= Results produced by ADMesh version 0.97.3 =================
+ Input file         : sphere.stl
+ File type          : Binary STL file
+ Header             : Processed by ADMesh version 0.97.3
++>>>>>>> upstream/0.97.3_git_3518914:README.md
  ============== Size ==============
  Min X = -1.334557, Max X = 1.370952
  Min Y = -1.377953, Max Y = 1.377230
@@@ -79,27 -102,14 +114,41 @@@ up to about 200,000 facets.  Files larg
  the system begins to slow down significantly due to swapping.  A system with
  more memory will be able to process greater numbers of facets more easily.
  Following are some indications of process times:
++<<<<<<< HEAD:README
 +40,000  facets: 10 seconds
 +80,000  facets: 20 seconds
 +160,000 facets: 50 seconds
 +320,000 facets: 13 minutes (heavy swapping occurred)
 +
 +There are a few features that are "missing" from ADMesh but that might be
 +added in the future.  These include:
 + * Display capability
 + * Slicing
 + * Splitting a file into smaller files
 +
 +ADMesh is free but Copyrighted software.  It is distributed under the terms
 +of the GNU General Public License (GPL).  It is NOT in the public domain and
 +its source code cannot be used in commercial software.  Details of the GPL
 +are in the file COPYING that comes with the ADMesh software package.
 +
 +ADMesh can be obtained on Launchpad from:
 +  https://launchpad.net/admesh
 +or from GitHub:
 +  https://github.com/gladk/admesh
 +
 +Send questions, comments, suggestions, etc. to me at the following address.
 +<amartin at engr.csulb.edu>
 +Anthony D. Martin
++=======
+ 
+  * 40,000  facets: 10 seconds
+  * 80,000  facets: 20 seconds
+  * 160,000 facets: 50 seconds
+  * 320,000 facets: 13 minutes (heavy swapping occurred)
+ 
+ Note that those times were calculated around 1996.
+ 
+ ADMesh is free but copyrighted software.  It is distributed under the terms
+ of the GNU General Public License (GPL). Details of the GPL are in the file
+ COPYING that comes with the ADMesh software package.
++>>>>>>> upstream/0.97.3_git_3518914:README.md
diff --cc admesh.1
index e9309e0,9832d33..81867c6
--- a/admesh.1
+++ b/admesh.1
@@@ -1,13 -1,41 +1,53 @@@
++<<<<<<< HEAD
 +.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.43.3.
 +.TH ADMESH "1" "July 2013" "ADMesh - version 0.96" "User Commands"
 +.SH NAME
 +ADMesh \- a program for processing triangulated solid meshes
++=======
+ .TH ADMESH "1" 21/10/2013 "User Commands"
+ .SH NAME
+ ADMesh - a program for processing triangulated solid meshes
++>>>>>>> upstream/0.97.3_git_3518914
  .SH SYNOPSIS
  .B admesh
  [\fIOPTION\fR]... \fIfile\fR
  .SH DESCRIPTION
++<<<<<<< HEAD
 +ADMesh version 0.96
 +Copyright \(co 1995, 1996  Anthony D. Martin
++=======
+ ADMesh is a program for processing triangulated solid meshes. Currently, ADMesh only reads the STL file format that is used for rapid prototyping applications, although it can write STL, VRML, OFF, and DXF files.
+ 
+ By default, ADMesh performs all of the mesh checking and repairing options
+ on the input file.  This means that is checks exact, nearby,
+ remove-unconnected, fill-holes, normal-directions, and normal-values.  The
+ file type (ASCII or binary) is automatically detected.  The input file is
+ not modified unless it is specified by the \fB--write\fP option.  If the following
+ command line was input:
+ 
+ .B admesh sphere.stl
+ 
+ The file sphere.stl would be opened and read, it would be checked and fixed
+ if necessary, and the results of processing would be printed out.  The
+ results would not be saved.
+ 
+ The default value for tolerance is the length of the shortest edge of the
+ mesh.  The default number of iterations is 2, and the default increment is
+ 0.01% of the diameter of a sphere that encloses the entire mesh.
+ 
+ If any of the options \fB--exact\fP, \fB--nearby\fP, \fB--remove-unconnected\fP, \fB--fill-holes\fP,
+ \fB--normal-directions\fP, \fB--reverse-all\fP, \fB--normal-values\fP, or \fB--no-check\fP are
+ given, then no other checks besides that one will be done unless they are
+ specified or unless they are required by ADMesh before the specified check
+ can be done.  For example the following command line:
+ 
+ .B admesh --remove-unconnected sphere.stl
+ 
+ would first do an exact check because it is required, and then the
+ unconnected facets would be removed.  The results would be printed and no
+ other checks would be done.
+ .SH OPTIONS
++>>>>>>> upstream/0.97.3_git_3518914
  .TP
  \fB\-\-x\-rotate\fR=\fIangle\fR
  Rotate CCW about x\-axis by angle degrees
@@@ -93,15 -121,53 +133,68 @@@ The functions are executed in the same 
  So check here to find what happens if, for example, \fB\-\-translate\fR and \fB\-\-merge\fR
  options are specified together.  The order of the options specified on the
  command line is not important.
++<<<<<<< HEAD
 +.SH "SEE ALSO"
 +The full documentation for
 +.B ADMesh
 +is maintained as a Texinfo manual.  If the
 +.B info
 +and
 +.B ADMesh
 +programs are properly installed at your site, the command
 +.IP
 +.B info ADMesh
 +.PP
 +should give you access to the complete manual.
++=======
+ .SH EXAMPLES
+ To perform all checks except for nearby, the following command line would be
+ used:
+ 
+ .B admesh --exact --remove-unconnected --fill-holes --normal-directions --normal-values sphere.stl
+ 
+ Actually, since the \fBexact\fP check is required by ADMesh before
+ \fBremove-unconnected\fP, and \fBremove-unconnected\fP is required before \fB--fill-holes\fP,
+ the above command line could be shortened as follows with the same results:
+ 
+ .B admesh --fill-holes --normal-directions --normal-values sphere.stl
+ 
+ And again the same results could be achieved using the short options:
+ 
+ .B admesh -fudev sphere.stl
+ 
+ or
+ 
+ .B admesh -fdv sphere.stl
+    
+ The following command lines do the same thing:
+ 
+ .B admesh sphere.stl
+ 
+ .B admesh -fundev sphere.stl
+ 
+ .B admesh -f -u -n -d -e -v sphere.stl
+ 
+ since the \fB-fundev\fP options are implied by default.  To eliminate one of the
+ checks, just remove the letter of the check to eliminate from the "word" fundev.
+ .SH SEE ALSO
+ For more information about the options and output read
+ .B admesh-doc.txt
+ - it is usually located in /usr/share/doc/admesh-x.xx dir.
+ .SH COPYRIGHT
+ Copyright (C) 1995, 1996  Anthony D. Martin <amartin at engr.csulb.edu>
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++>>>>>>> upstream/0.97.3_git_3518914
diff --cc src/admesh.c
index 1ce2951,59e51d8..414acdb
--- a/src/admesh.c
+++ b/src/admesh.c
@@@ -24,11 -26,12 +26,20 @@@
  
  
  #include "stl.h"
++<<<<<<< HEAD:admesh.c
 +#include "version.h"
 +
 +static void usage(int status, char *program_name);
 +
 +int main(int argc, char **argv)
++=======
+ #include "config.h"
+ 
+ static void usage(int status, char *program_name);
+ 
+ int
+ main(int argc, char **argv)
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
  {
    stl_file stl_in;
    int      i;
@@@ -240,8 -244,8 +252,13 @@@
      }
    if(version_flag)
      {
++<<<<<<< HEAD:admesh.c
 +      printf("ADMesh - version %g\n",VERSION);
 +      exit(0);
++=======
+       printf("ADMesh - version " VERSION "\n");
+       return 0;
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
      }
    
    if(optind == argc)
@@@ -255,9 -260,9 +273,13 @@@
      }
  
    printf("\
++<<<<<<< HEAD:admesh.c
 +ADMesh version %g, Copyright (C) 1995, 1996 Anthony D. Martin\n\
++=======
+ ADMesh version " VERSION ", Copyright (C) 1995, 1996 Anthony D. Martin\n\
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
  ADMesh comes with NO WARRANTY.  This is free software, and you are welcome to\n\
 -redistribute it under certain conditions.  See the file COPYING for details.\n");
 +redistribute it under certain conditions.  See the file COPYING for details.\n",VERSION);
  
    
    printf("Opening %s\n", input_file);
@@@ -307,7 -312,7 +329,11 @@@
    if(merge_flag)
      {
        printf("Merging %s with %s\n", input_file, merge_name);
++<<<<<<< HEAD:admesh.c
 +      //Open the file and add the contents to stl_in:
++=======
+       /* Open the file and add the contents to stl_in: */
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
        stl_open_merge(&stl_in, merge_name);
      }
    
@@@ -434,9 -439,7 +460,13 @@@ All facets connected.  No further nearb
    if(write_dxf_flag)
      {
        printf("Writing DXF file %s\n", dxf_name);
++<<<<<<< HEAD:admesh.c
 +      char *tmp_msg = NULL;
 +      sprintf(tmp_msg,"Created by ADMesh version %g",VERSION);
 +      stl_write_dxf(&stl_in, dxf_name, tmp_msg);
++=======
+       stl_write_dxf(&stl_in, dxf_name, "Created by ADMesh version " VERSION);
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
      }
  
    if(write_vrml_flag)
@@@ -448,19 -451,15 +478,29 @@@
    if(write_ascii_stl_flag)
      {
        printf("Writing ascii file %s\n", ascii_name);
++<<<<<<< HEAD:admesh.c
 +
 +      char *tmp_msg = NULL;
 +      sprintf(tmp_msg,"Processed by ADMesh version %g",VERSION);
 +      stl_write_ascii(&stl_in, ascii_name, tmp_msg);
++=======
+       stl_write_ascii(&stl_in, ascii_name, 
+ 		      "Processed by ADMesh version " VERSION);
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
      }
    
    if(write_binary_stl_flag)
      {
        printf("Writing binary file %s\n", binary_name);
++<<<<<<< HEAD:admesh.c
 +      
 +      char *tmp_msg = NULL;
 +      sprintf(tmp_msg,"Processed by ADMesh version %g",VERSION);
 +      stl_write_binary(&stl_in, binary_name, tmp_msg);
++=======
+       stl_write_binary(&stl_in, binary_name,
+ 		       "Processed by ADMesh version " VERSION);
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
      }
    
    if(exact_flag)
@@@ -482,43 -481,42 +522,82 @@@ usage(int status, char *program_name
      }
    else
      {
++<<<<<<< HEAD:admesh.c
 +      printf("\n\
 +ADMesh version %g\n\
 +Copyright (C) 1995, 1996  Anthony D. Martin\n\
 +Usage: %s [OPTION]... file\n", VERSION, program_name);
 +      printf("\n\
 +     --x-rotate=angle     Rotate CCW about x-axis by angle degrees\n\
 +     --y-rotate=angle     Rotate CCW about y-axis by angle degrees\n\
 +     --z-rotate=angle     Rotate CCW about z-axis by angle degrees\n\
 +     --xy-mirror          Mirror about the xy plane\n\
 +     --yz-mirror          Mirror about the yz plane\n\
 +     --xz-mirror          Mirror about the xz plane\n\
 +     --scale=factor       Scale the file by factor (multiply by factor)\n\
 +     --translate=x,y,z    Translate the file to x, y, and z\n\
 +     --merge=name         Merge file called name with input file\n\
 + -e, --exact              Only check for perfectly matched edges\n\
 + -n, --nearby             Find and connect nearby facets. Correct bad facets\n\
 + -t, --tolerance=tol      Initial tolerance to use for nearby check = tol\n\
 + -i, --iterations=i       Number of iterations for nearby check = i\n\
 + -m, --increment=inc      Amount to increment tolerance after iteration=inc\n\
 + -u, --remove-unconnected Remove facets that have 0 neighbors\n\
 + -f, --fill-holes         Add facets to fill holes\n\
 + -d, --normal-directions  Check and fix direction of normals(ie cw, ccw)\n\
 +     --reverse-all        Reverse the directions of all facets and normals\n\
 + -v, --normal-values      Check and fix normal values\n\
 + -c, --no-check           Don't do any check on input file\n\
 + -b, --write-binary-stl=name   Output a binary STL file called name\n\
 + -a, --write-ascii-stl=name    Output an ascii STL file called name\n\
 +     --write-off=name     Output a Geomview OFF format file called name\n\
 +     --write-dxf=name     Output a DXF format file called name\n\
 +     --write-vrml=name    Output a VRML format file called name\n\
 +     --help               Display this help and exit\n\
 +     --version            Output version information and exit\n\
 +\n\
 +The functions are executed in the same order as the options shown here.\n\
 +So check here to find what happens if, for example, --translate and --merge\n\
 +options are specified together.  The order of the options specified on the\n\
 +command line is not important.\n");
++=======
+       printf("\n");
+       printf("ADMesh version " VERSION "\n");
+       printf("Copyright (C) 1995, 1996  Anthony D. Martin\n");
+       printf("Usage: %s [OPTION]... file\n", program_name);
+       printf("\n");
+       printf("     --x-rotate=angle     Rotate CCW about x-axis by angle degrees\n");
+       printf("     --y-rotate=angle     Rotate CCW about y-axis by angle degrees\n");
+       printf("     --z-rotate=angle     Rotate CCW about z-axis by angle degrees\n");
+       printf("     --xy-mirror          Mirror about the xy plane\n");
+       printf("     --yz-mirror          Mirror about the yz plane\n");
+       printf("     --xz-mirror          Mirror about the xz plane\n");
+       printf("     --scale=factor       Scale the file by factor (multiply by factor)\n");
+       printf("     --translate=x,y,z    Translate the file to x, y, and z\n");
+       printf("     --merge=name         Merge file called name with input file\n");
+       printf(" -e, --exact              Only check for perfectly matched edges\n");
+       printf(" -n, --nearby             Find and connect nearby facets. Correct bad facets\n");
+       printf(" -t, --tolerance=tol      Initial tolerance to use for nearby check = tol\n");
+       printf(" -i, --iterations=i       Number of iterations for nearby check = i\n");
+       printf(" -m, --increment=inc      Amount to increment tolerance after iteration=inc\n");
+       printf(" -u, --remove-unconnected Remove facets that have 0 neighbors\n");
+       printf(" -f, --fill-holes         Add facets to fill holes\n");
+       printf(" -d, --normal-directions  Check and fix direction of normals(ie cw, ccw)\n");
+       printf("     --reverse-all        Reverse the directions of all facets and normals\n");
+       printf(" -v, --normal-values      Check and fix normal values\n");
+       printf(" -c, --no-check           Don't do any check on input file\n");
+       printf(" -b, --write-binary-stl=name   Output a binary STL file called name\n");
+       printf(" -a, --write-ascii-stl=name    Output an ascii STL file called name\n");
+       printf("     --write-off=name     Output a Geomview OFF format file called name\n");
+       printf("     --write-dxf=name     Output a DXF format file called name\n");
+       printf("     --write-vrml=name    Output a VRML format file called name\n");
+       printf("     --help               Display this help and exit\n");
+       printf("     --version            Output version information and exit\n");
+       printf("\n");
+       printf("The functions are executed in the same order as the options shown here.\n");
+       printf("So check here to find what happens if, for example, --translate and --merge\n");
+       printf("options are specified together.  The order of the options specified on the\n");
+       printf("command line is not important.\n");
++>>>>>>> upstream/0.97.3_git_3518914:src/admesh.c
      }
-   exit(status);
  }  
diff --cc src/connect.c
index 9690c51,118ae7d..e094be4
--- a/src/connect.c
+++ b/src/connect.c
@@@ -82,7 -84,7 +84,11 @@@ stl_check_facets_exact(stl_file *stl
      {
        facet = stl->facet_start[i];
  
++<<<<<<< HEAD:connect.c
 +      //If any two of the three vertices are found to be exactally the same, call them degenerate and remove the facet.
++=======
+       /* If any two of the three vertices are found to be exactally the same, call them degenerate and remove the facet. */
++>>>>>>> upstream/0.97.3_git_3518914:src/connect.c
        if(   !memcmp(&facet.vertex[0], &facet.vertex[1], 
  		    sizeof(stl_vertex))
  	 || !memcmp(&facet.vertex[1], &facet.vertex[2], 
diff --cc src/normals.c
index 97018aa,795c2c4..51fc022
--- a/src/normals.c
+++ b/src/normals.c
@@@ -116,44 -117,41 +117,67 @@@ stl_fix_normal_directions(stl_file *stl
    tail->next = tail;
  
    /* Initialize list that keeps track of already fixed facets. */
-   norm_sw = calloc(stl->stats.number_of_facets, sizeof(char));
+   norm_sw = (char*)calloc(stl->stats.number_of_facets, sizeof(char));
    if(norm_sw == NULL) perror("stl_fix_normal_directions");
    
 -
    facet_num = 0;
++<<<<<<< HEAD:normals.c
 +  //If normal vector is not within tolerance and backwards:
 +  //Arbitrarily starts at face 0.  If this one is wrong, we're screwed.  Thankfully, the chances
 +  // of it being wrong randomly are low if most of the triangles are right:
 +  if(stl_check_normal_vector(stl, 0, 0) == 2)
 +    stl_reverse_facet(stl, 0);
 +     
 +  //Say that we've fixed this facet:
++=======
+   /* If normal vector is not within tolerance and backwards:
+      Arbitrarily starts at face 0.  If this one is wrong, we're screwed.  Thankfully, the chances
+      of it being wrong randomly are low if most of the triangles are right: */
+   if(stl_check_normal_vector(stl, 0, 0) == 2)
+     stl_reverse_facet(stl, 0);
+      
+   /* Say that we've fixed this facet: */
++>>>>>>> upstream/0.97.3_git_3518914:src/normals.c
    norm_sw[facet_num] = 1;
-   /*  edge_num = 0;
-       vnot = stl->neighbors_start[0].which_vertex_not[0];
-       */
    checked++;
  
    for(;;)
      {
++<<<<<<< HEAD:normals.c
 +      /* Add neighbors_to_list. */
 +      //Add unconnected neighbors to the list:a
++=======
+       /* Add neighbors_to_list.
+          Add unconnected neighbors to the list:a  */
++>>>>>>> upstream/0.97.3_git_3518914:src/normals.c
        for(j = 0; j < 3; j++)
  	{
  	  /* Reverse the neighboring facets if necessary. */
  	  if(stl->neighbors_start[facet_num].which_vertex_not[j] > 2)
  	    {
++<<<<<<< HEAD:normals.c
 +        // If the facet has a neighbor that is -1, it means that edge isn't shared by another
 +        // facet.
++=======
+ 	    /* If the facet has a neighbor that is -1, it means that edge isn't shared by another facet */
++>>>>>>> upstream/0.97.3_git_3518914:src/normals.c
  	      if(stl->neighbors_start[facet_num].neighbor[j] != -1)
  		{
  		  stl_reverse_facet
  		    (stl, stl->neighbors_start[facet_num].neighbor[j]);
  		}
  	    }
++<<<<<<< HEAD:normals.c
 +    //If this edge of the facet is connected:
 +	  if(stl->neighbors_start[facet_num].neighbor[j] != -1)
 +	    {
 +        //If we haven't fixed this facet yet, add it to the list:
++=======
+     /* If this edge of the facet is connected: */
+ 	  if(stl->neighbors_start[facet_num].neighbor[j] != -1)
+ 	    {
+         /* If we haven't fixed this facet yet, add it to the list: */
++>>>>>>> upstream/0.97.3_git_3518914:src/normals.c
  	      if(norm_sw[stl->neighbors_start[facet_num].neighbor[j]] != 1)
  		{
  		  /* Add node to beginning of list. */
@@@ -178,13 -176,10 +202,20 @@@
  	  head->next = head->next->next;
  	  free(temp);
  	}
++<<<<<<< HEAD:normals.c
 +      else  //if we ran out of facets to fix:
 +	{
 +	  /* All of the facets in this part have been fixed. */
 +	  stl->stats.number_of_parts += 1;
 +	  /* There are (checked-checked_before) facets */
 +	  /* in part stl->stats.number_of_parts */
 +	  checked_before = checked;
++=======
+       else  /* if we ran out of facets to fix: */
+ 	{
+ 	  /* All of the facets in this part have been fixed. */
+ 	  stl->stats.number_of_parts += 1;
++>>>>>>> upstream/0.97.3_git_3518914:src/normals.c
  	  if(checked >= stl->stats.number_of_facets)
  	    {
  	      /* All of the facets have been checked.  Bail out. */
diff --cc src/stl_io.c
index ce51e32,366f6b6..4e8cb88
--- a/src/stl_io.c
+++ b/src/stl_io.c
@@@ -21,7 -23,7 +23,11 @@@
  #include <stdlib.h>
  #include <string.h>
  #include "stl.h"
++<<<<<<< HEAD:stl_io.c
 +#include "version.h"
++=======
+ #include "config.h"
++>>>>>>> upstream/0.97.3_git_3518914:src/stl_io.c
  
  #if !defined(SEEK_SET)
  #define SEEK_SET 0
@@@ -53,8 -55,13 +59,17 @@@ stl_print_edges(stl_file *stl, FILE *fi
  void
  stl_stats_out(stl_file *stl, FILE *file, char *input_file)
  {
+   /* this is here for Slic3r, without our config.h
+      it won't use this part of the code anyway */
+   #ifndef VERSION
+   #define VERSION "unknown"
+   #endif
    fprintf(file, "\n\
++<<<<<<< HEAD:stl_io.c
 +================= Results produced by ADMesh version %g ================\n",VERSION);
++=======
+ ================= Results produced by ADMesh version " VERSION " ================\n");
++>>>>>>> upstream/0.97.3_git_3518914:src/stl_io.c
    fprintf(file, "\
  Input file         : %s\n", input_file);
    if(stl->stats.type == binary)
@@@ -133,10 -140,10 +148,15 @@@ stl_write_ascii(stl_file *stl, const ch
    fp = fopen(file, "w");
    if(fp == NULL)
      {
++<<<<<<< HEAD:stl_io.c
 +      error_msg = 
 +      malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */
++=======
+       error_msg = (char*)
+ 	malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */
++>>>>>>> upstream/0.97.3_git_3518914:src/stl_io.c
        sprintf(error_msg, "stl_write_ascii: Couldn't open %s for writing",
 -	      file);
 +      file);
        perror(error_msg);
        free(error_msg);
        exit(1);
diff --cc src/stlinit.c
index bcea18a,630c263..a0d2e2b
--- a/src/stlinit.c
+++ b/src/stlinit.c
@@@ -121,13 -94,20 +94,24 @@@ stl_count_facets(stl_file *stl, char *f
    
    /* Check for binary or ASCII file */
    fseek(stl->fp, HEADER_SIZE, SEEK_SET);
++<<<<<<< HEAD:stlinit.c
 +  size_t retSize = fread(chtest, sizeof(chtest), 1, stl->fp);
++=======
+   if (!fread(chtest, sizeof(chtest), 1, stl->fp))
+   {
+     perror("The input is an empty file");
+     exit(1);
+   }
++>>>>>>> upstream/0.97.3_git_3518914:src/stlinit.c
    stl->stats.type = ascii;
-   for(i = 0; i < sizeof(chtest); i++)
+   for(s = 0; s < sizeof(chtest); s++)
      {
-       if(chtest[i] > 127)
+       if(chtest[s] > 127)
  	{
  	  stl->stats.type = binary;
+ 	  /* close and reopen with binary flag (needed on Windows) */
+ 	  fclose(stl->fp);
+ 	  stl->fp = fopen(file, "rb");
  	  break;
  	}
      }
@@@ -147,15 -127,13 +131,22 @@@
        num_facets = (file_size - HEADER_SIZE) / SIZEOF_STL_FACET;
  
        /* Read the header */
++<<<<<<< HEAD:stlinit.c
 +      retSize = fread(stl->stats.header, LABEL_SIZE, 1, stl->fp);
 +      
 +      if (retSize>79) {
 +        stl->stats.header[80] = '\0';
 +      }
 +      
++=======
+       if (fread(stl->stats.header, LABEL_SIZE, 1, stl->fp) > 79)
+       {
+         stl->stats.header[80] = '\0';
+       }
+ 
++>>>>>>> upstream/0.97.3_git_3518914:src/stlinit.c
        /* Read the int following the header.  This should contain # of facets */
-       header_num_facets = stl_get_little_int(stl->fp);
-       if(num_facets != header_num_facets)
+       if((!fread(&header_num_facets, sizeof(int), 1, stl->fp)) || (num_facets != header_num_facets))
  	{
  	  fprintf(stderr, 
  	  "Warning: File size doesn't match number of facets in the header\n");
@@@ -213,42 -189,43 +204,82 @@@ voi
  stl_open_merge(stl_file *stl, char *file_to_merge)
  {
    int num_facets_so_far;
++<<<<<<< HEAD:stlinit.c
 +  
 +  //Record how many facets we have so far from the first file.  We will start putting
 +  //facets in the next position.  Since we're 0-indexed, it'l be the same position.
 +  num_facets_so_far = stl->stats.number_of_facets;
 +  
 +  //Record the file type we started with:
 +  stl_type origStlType=stl->stats.type;
 +  //Record the file pointer too:
 +  FILE *origFp=stl->fp;
 +  
 +  //Create an stl_file structure for the file to merge:
 +  stl_file stl_to_merge;  
 +  
 +  //Initialize the sturucture with zero stats, header info and sizes:
 +  stl_initialize(&stl_to_merge, file_to_merge);
 +  
 +  //Copy what we need to into stl so that we can read the file_to_merge directly into it
 +  //using stl_read:  Save the rest of the valuable info:
 +  stl->stats.type=stl_to_merge.stats.type;
 +  stl->fp=stl_to_merge.fp;
 +  
 +  //Add the number of facets we already have in stl with what we we found in stl_to_merge but 
 +  //haven't read yet.
 +  stl->stats.number_of_facets=num_facets_so_far+stl_to_merge.stats.number_of_facets;
 +  
 +  //Allocate enough room for stl->stats.number_of_facets facets and neighbors:
 +  stl_reallocate(stl);
 +  
 +  //Read the file to merge directly into stl, adding it to what we have already.
 +  // Start at num_facets_so_far, the index to the first unused facet.  Also say
 +  // that this isn't our first time so we should augment stats like min and max 
 +  //instead of erasing them.
 +  stl_read(stl, num_facets_so_far, 0);
 +  
 +  //Restore the stl information we overwrote (for stl_read) so that it still accurately
 +  // reflects the subject part:
++=======
+   stl_type origStlType;
+   FILE *origFp;
+   stl_file stl_to_merge;  
+   
+   /* Record how many facets we have so far from the first file.  We will start putting
+      facets in the next position.  Since we're 0-indexed, it'l be the same position. */
+   num_facets_so_far = stl->stats.number_of_facets;
+   
+   /* Record the file type we started with: */
+   origStlType=stl->stats.type;
+   /* Record the file pointer too: */
+   origFp=stl->fp;
+   
+   /* Initialize the sturucture with zero stats, header info and sizes: */
+   stl_initialize(&stl_to_merge);
+   stl_count_facets(&stl_to_merge, file_to_merge);
+   
+   /* Copy what we need to into stl so that we can read the file_to_merge directly into it
+      using stl_read:  Save the rest of the valuable info: */
+   stl->stats.type=stl_to_merge.stats.type;
+   stl->fp=stl_to_merge.fp;
+   
+   /* Add the number of facets we already have in stl with what we we found in stl_to_merge but 
+      haven't read yet. */
+   stl->stats.number_of_facets=num_facets_so_far+stl_to_merge.stats.number_of_facets;
+   
+   /* Allocate enough room for stl->stats.number_of_facets facets and neighbors: */
+   stl_reallocate(stl);
+   
+   /* Read the file to merge directly into stl, adding it to what we have already.
+      Start at num_facets_so_far, the index to the first unused facet.  Also say
+      that this isn't our first time so we should augment stats like min and max 
+      instead of erasing them. */
+   stl_read(stl, num_facets_so_far, 0);
+   
+   /* Restore the stl information we overwrote (for stl_read) so that it still accurately
+      reflects the subject part: */
++>>>>>>> upstream/0.97.3_git_3518914:src/stlinit.c
    stl->stats.type=origStlType;
    stl->fp=origFp;
  }
@@@ -269,10 -246,11 +300,18 @@@ stl_reallocate(stl_file *stl
    if(stl->facet_start == NULL) perror("stl_initialize");
  }
  
++<<<<<<< HEAD:stlinit.c
 +//Reads the contents of the file pointed to by stl->fp into the stl structure,
 +//starting at facet first_facet.  The second argument says if it's our first
 +// time running this for the stl and therefore we should reset our max and min stats.
 +static void
++=======
+ 
+ /* Reads the contents of the file pointed to by stl->fp into the stl structure,
+    starting at facet first_facet.  The second argument says if it's our first
+    time running this for the stl and therefore we should reset our max and min stats. */
+ void
++>>>>>>> upstream/0.97.3_git_3518914:src/stlinit.c
  stl_read(stl_file *stl, int first_facet, int first)
  {
    stl_facet facet;
@@@ -315,19 -283,19 +344,35 @@@
  	}
        else
  	/* Read a single facet from an ASCII .STL file */
++<<<<<<< HEAD:stlinit.c
 +  {
 +    size_t retSize = fscanf(stl->fp, "%*s %*s %f %f %f\n", 
 +      &facet.normal.x, &facet.normal.y, &facet.normal.z);
 +    retSize = fscanf(stl->fp, "%*s %*s");
 +    retSize = fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[0].x,
 +      &facet.vertex[0].y,  &facet.vertex[0].z);
 +    retSize = fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[1].x,
 +      &facet.vertex[1].y,  &facet.vertex[1].z);
 +    retSize = fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[2].x,
 +      &facet.vertex[2].y,  &facet.vertex[2].z);
 +    retSize = fscanf(stl->fp, "%*s");
 +    retSize = fscanf(stl->fp, "%*s");
 +  }
++=======
+ 	{
+       	  if((fscanf(stl->fp, "%*s %*s %f %f %f\n", &facet.normal.x, &facet.normal.y, &facet.normal.z) + \
+ 	     fscanf(stl->fp, "%*s %*s") + \
+ 	     fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[0].x, &facet.vertex[0].y,  &facet.vertex[0].z) + \
+ 	     fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[1].x, &facet.vertex[1].y,  &facet.vertex[1].z) + \
+ 	     fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[2].x, &facet.vertex[2].y,  &facet.vertex[2].z) + \
+ 	     fscanf(stl->fp, "%*s") + \
+ 	     fscanf(stl->fp, "%*s")) != 12)
+ 	  {
+ 	    perror("Something is syntactically very wrong with this ASCII STL!");
+ 	    exit(1);
+ 	  }
+ 	}
++>>>>>>> upstream/0.97.3_git_3518914:src/stlinit.c
        /* Write the facet into memory. */
        stl->facet_start[i] = facet;
        
diff --cc src/util.c
index f252e1a,6b4e766..7af66a4
--- a/src/util.c
+++ b/src/util.c
@@@ -88,21 -88,24 +89,33 @@@ stl_translate(stl_file *stl, float x, f
      {
        for(j = 0; j < 3; j++)
  	{
 -	  stl->facet_start[i].vertex[j].x -= (stl->stats.min.x - x);
 -	  stl->facet_start[i].vertex[j].y -= (stl->stats.min.y - y);
 -	  stl->facet_start[i].vertex[j].z -= (stl->stats.min.z - z);
 +	  stl->facet_start[i].vertex[j].x += x;
 +	  stl->facet_start[i].vertex[j].y += y;
 +	  stl->facet_start[i].vertex[j].z += z;
  	}
      }
++<<<<<<< HEAD:util.c
 +  stl->stats.max.x += x;
 +  stl->stats.max.y += y;
 +  stl->stats.max.z += z;
 +  stl->stats.min.x += x;
 +  stl->stats.min.y += y;
 +  stl->stats.min.z += z;
++=======
+   stl->stats.max.x -= (stl->stats.min.x - x);
+   stl->stats.max.y -= (stl->stats.min.y - y);
+   stl->stats.max.z -= (stl->stats.min.z - z);
+   stl->stats.min.x = x;
+   stl->stats.min.y = y;
+   stl->stats.min.z = z;
+   
+   stl_invalidate_shared_vertices(stl);
++>>>>>>> upstream/0.97.3_git_3518914:src/util.c
  }
  
+ /* Translates the stl by x,y,z, relatively from wherever it is currently */
  void
- stl_scale(stl_file *stl, float factor)
+ stl_translate_relative(stl_file *stl, float x, float y, float z)
  {
    int i;
    int j;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/admesh.git



More information about the debian-science-commits mailing list