泊松表面重建源码,可实现有向点云的表面重建,执行效率高、重建结果准

  • 虫虫123456
    了解作者
  • matlab
    开发工具
  • 146.3KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 5 积分
    下载积分
  • 0
    下载次数
  • 2022-06-26 16:40
    上传日期
泊松表面重建源码,可实现有向点云的表面重建,执行效率高、重建结果准
vzwJQ2vbgx.rar
  • Src
  • Vector.inl
    6.8KB
  • BSplineData.inl
    20KB
  • Time.cpp
    1.9KB
  • MarchingCubes.h
    5.8KB
  • SparseMatrix.h
    6KB
  • Factor.cpp
    7.2KB
  • BSplineData.h
    5.5KB
  • PointStream.h
    2.8KB
  • Octree.h
    11.3KB
  • FunctionData.inl
    15.1KB
  • PPolynomial.h
    4KB
  • Hash.h
    737B
  • MAT.inl
    5.8KB
  • Geometry.inl
    13.8KB
  • ply.h
    9.3KB
  • MultiGridOctreeData.h
    19.9KB
  • PointStream.inl
    9KB
  • MultiGridOctest.cpp
    15.7KB
  • plyfile.cpp
    75KB
  • Geometry.h
    13.8KB
  • SparseMatrix.inl
    29.2KB
  • ply.cpp
    11.3KB
  • Polynomial.h
    3.7KB
  • PlyFile.h
    8.4KB
  • MarchingCubes.cpp
    43.2KB
  • PPolynomial.inl
    12.7KB
  • Array.inl
    19.8KB
  • CmdLineParser.inl
    3.9KB
  • Factor.h
    2.4KB
  • Vector.h
    3.1KB
  • MultiGridOctreeData.inl
    156.4KB
  • CmdLineParser.h
    3.9KB
  • Geometry.cpp
    8.9KB
  • Array.h
    6.3KB
  • Allocator.h
    5.5KB
  • CmdLineParser.cpp
    6.5KB
  • FunctionData.h
    4.8KB
  • MAT.h
    2.2KB
  • Polynomial.inl
    10.1KB
  • BinaryNode.h
    3.2KB
  • MemoryUsage.h
    5.4KB
  • Time.h
    1.6KB
  • Octree.inl
    80.1KB
内容介绍
/* The interface routines for reading and writing PLY polygon files. Greg Turk, February 1994 --------------------------------------------------------------- A PLY file contains a single polygonal _object_. An object is composed of lists of _elements_. Typical elements are vertices, faces, edges and materials. Each type of element for a given object has one or more _properties_ associated with the element type. For instance, a vertex element may have as properties the floating-point values x,y,z and the three unsigned chars representing red, green and blue. --------------------------------------------------------------- Copyright (c) 1994 The Board of Trustees of The Leland Stanford Junior University. All rights reserved. Permission to use, copy, modify and distribute this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice and this permission notice appear in all copies of this software and that you do not sell the software. THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include "PlyFile.h" char *type_names[] = { "invalid", "char", "short", "int", "uchar", "ushort", "uint", "float", "double", "int8", // character 1 "uint8", // unsigned character 1 "int16", // short integer 2 "uint16", // unsigned short integer 2 "int32", // integer 4 "uint32", // unsigned integer 4 "float32", // single-precision float 4 "float64", // double-precision float 8 }; int ply_type_size[] = { 0, 1, 2, 4, 1, 2, 4, 4, 8, 1, 1, 2, 2, 4, 4, 8 }; typedef union { int int_value; char byte_values[sizeof(int)]; } endian_test_type; static int native_binary_type = -1; static int types_checked = 0; #define NO_OTHER_PROPS -1 #define DONT_STORE_PROP 0 #define STORE_PROP 1 #define OTHER_PROP 0 #define NAMED_PROP 1 /* returns 1 if strings are equal, 0 if not */ int equal_strings(char *, char *); /* find an element in a plyfile's list */ PlyElement *find_element(PlyFile *, char *); /* find a property in an element's list */ PlyProperty *find_property(PlyElement *, char *, int *); /* write to a file the word describing a PLY file data type */ void write_scalar_type (FILE *, int); /* read a line from a file and break it up into separate words */ char **get_words(FILE *, int *, char **); char **old_get_words(FILE *, int *); /* write an item to a file */ void write_binary_item(FILE *, int, int, unsigned int, double, int); void write_ascii_item(FILE *, int, unsigned int, double, int); double old_write_ascii_item(FILE *, char *, int); /* add information to a PLY file descriptor */ void add_element(PlyFile *, char **); void add_property(PlyFile *, char **); void add_comment(PlyFile *, char *); void add_obj_info(PlyFile *, char *); /* copy a property */ void copy_property(PlyProperty *, PlyProperty *); /* store a value into where a pointer and a type specify */ void store_item(char *, int, int, unsigned int, double); /* return the value of a stored item */ void get_stored_item( void *, int, int *, unsigned int *, double *); /* return the value stored in an item, given ptr to it and its type */ double get_item_value(char *, int); /* get binary or ascii item and store it according to ptr and type */ void get_ascii_item(char *, int, int *, unsigned int *, double *); void get_binary_item(FILE *, int, int, int *, unsigned int *, double *); /* get a bunch of elements from a file */ void ascii_get_element(PlyFile *, char *); void binary_get_element(PlyFile *, char *); /* memory allocation */ char *my_alloc(int, int, char *); /* byte ordering */ void get_native_binary_type(); void swap_bytes(char *, int); void check_types(); /*************/ /* Writing */ /*************/ /****************************************************************************** Given a file pointer, get ready to write PLY data to the file. Entry: fp - the given file pointer nelems - number of elements in object elem_names - list of element names file_type - file type, either ascii or binary Exit: returns a pointer to a PlyFile, used to refer to this file, or NULL if error ******************************************************************************/ PlyFile *ply_write( FILE *fp, int nelems, char **elem_names, int file_type ) { int i; PlyFile *plyfile; PlyElement *elem; /* check for NULL file pointer */ if (fp == NULL) return (NULL); if (native_binary_type == -1) get_native_binary_type(); if (!types_checked) check_types(); /* create a record for this object */ plyfile = (PlyFile *) myalloc (sizeof (PlyFile)); if (file_type == PLY_BINARY_NATIVE) plyfile->file_type = native_binary_type; else plyfile->file_type = file_type; plyfile->num_comments = 0; plyfile->num_obj_info = 0; plyfile->nelems = nelems; plyfile->version = 1.0; plyfile->fp = fp; plyfile->other_elems = NULL; /* tuck aside the names of the elements */ plyfile->elems = (PlyElement **) myalloc (sizeof (PlyElement *) * nelems); for (i = 0; i < nelems; i++) { elem = (PlyElement *) myalloc (sizeof (PlyElement)); plyfile->elems[i] = elem; elem->name = _strdup (elem_names[i]); elem->num = 0; elem->nprops = 0; } /* return pointer to the file descriptor */ return (plyfile); } /****************************************************************************** Open a polygon file for writing. Entry: filename - name of file to read from nelems - number of elements in object elem_names - list of element names file_type - file type, either ascii or binary Exit: version - version number of PLY file returns a file identifier, used to refer to this file, or NULL if error ******************************************************************************/ PlyFile *ply_open_for_writing( char *filename, int nelems, char **elem_names, int file_type, float *version ) { PlyFile *plyfile; char *name; FILE *fp; /* tack on the extension .ply, if necessary */ name = (char *) myalloc (int(sizeof (char) * (strlen (filename)) + 5)); strcpy (name, filename); if (strlen (name) < 4 || strcmp (name + strlen (name) - 4, ".ply") != 0) strcat (name, ".ply"); /* open the file for writing */ fp = fopen (name, "wb"); if (fp == NULL) { return (NULL); } /* create the actual PlyFile structure */ plyfile = ply_write (fp, nelems, elem_names, file_type); if (plyfile == NULL) return (NULL); /* say what PLY file version number we're writing */ *version = plyfile->version; /* return pointer to the file descriptor */ return (plyfile); } /****************************************************************************** Describe an element, including its properties and how many will be written to the file. Entry: plyfile - file identifier elem_name - name of element that information is being specified about nelems - number of elements of this type to be written nprops - number of properties contained in the element prop_list - list of properties ******************************************************************************/ void ply_describe_element( PlyFile *plyfile, char *elem_name,
评论
    相关推荐