-
大小: 1.33MB文件類型: .tar金幣: 1下載: 0 次發(fā)布日期: 2023-10-29
- 語言: 其他
- 標(biāo)簽: 網(wǎng)格模型??簡(jiǎn)化??二次誤差??
資源簡(jiǎn)介
這是一個(gè)網(wǎng)格模型的簡(jiǎn)化算法,使用了二次誤差技術(shù)。
代碼片段和文件信息
/*
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?xyz?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?
#include?
#include?
#include?
#include?“ply.h“
char?*type_names[]?=?{
“invalid“
“char“?“short“?“int“
“uchar“?“ushort“?“uint“
“float“?“double“
};
int?ply_type_size[]?=?{
??0?1?2?4?1?2?4?4?8
};
#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?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?**?int);
void?add_property(PlyFile?*?char?**?int);
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);
/*?ge
評(píng)論
共有 條評(píng)論