[1097] | 1 | #ifndef MXPROPSLIM_INCLUDED // -*- C++ -*-
|
---|
| 2 | #define MXPROPSLIM_INCLUDED
|
---|
| 3 | #if !defined(__GNUC__)
|
---|
| 4 | # pragma once
|
---|
| 5 | #endif
|
---|
| 6 |
|
---|
| 7 | /************************************************************************
|
---|
| 8 |
|
---|
| 9 | MxPropSlim
|
---|
| 10 |
|
---|
| 11 | Copyright (C) 1998 Michael Garland. See "COPYING.txt" for details.
|
---|
| 12 |
|
---|
| 13 | $Id: MxPropSlim.h,v 1.1 2002/09/24 16:53:54 wimmer Exp $
|
---|
| 14 |
|
---|
| 15 | ************************************************************************/
|
---|
| 16 |
|
---|
| 17 | #include "MxStdSlim.h"
|
---|
| 18 | #include "MxQMetric.h"
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | class MxPropSlim : public MxStdSlim
|
---|
| 22 | {
|
---|
| 23 | private:
|
---|
| 24 | uint D;
|
---|
| 25 |
|
---|
| 26 | bool use_color;
|
---|
| 27 | bool use_texture;
|
---|
| 28 | bool use_normals;
|
---|
| 29 |
|
---|
| 30 | class edge_info : public MxHeapable
|
---|
| 31 | {
|
---|
| 32 | public:
|
---|
| 33 | MxVertexID v1, v2;
|
---|
| 34 | MxVector target;
|
---|
| 35 |
|
---|
| 36 | edge_info(uint D) : target(D) { }
|
---|
| 37 | };
|
---|
| 38 | typedef MxSizedDynBlock<edge_info*, 6> edge_list;
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | MxBlock<edge_list> edge_links; // 1 per vertex
|
---|
| 42 | MxBlock<MxQuadric*> __quadrics; // 1 per vertex
|
---|
| 43 |
|
---|
| 44 | //
|
---|
| 45 | // Temporary variables used by methods
|
---|
| 46 | MxVertexList star, star2;
|
---|
| 47 | MxPairContraction conx_tmp;
|
---|
| 48 |
|
---|
| 49 | protected:
|
---|
| 50 | uint compute_dimension(MxStdModel *);
|
---|
| 51 | void pack_to_vector(MxVertexID, MxVector&);
|
---|
| 52 | void unpack_from_vector(MxVertexID, MxVector&);
|
---|
| 53 | uint prop_count();
|
---|
| 54 | void pack_prop_to_vector(MxVertexID, MxVector&, uint);
|
---|
| 55 | void unpack_prop_from_vector(MxVertexID, MxVector&, uint);
|
---|
| 56 |
|
---|
| 57 | void compute_face_quadric(MxFaceID, MxQuadric&);
|
---|
| 58 | void collect_quadrics();
|
---|
| 59 |
|
---|
| 60 | void create_edge(MxVertexID, MxVertexID);
|
---|
| 61 | void collect_edges();
|
---|
| 62 | void constrain_boundaries();
|
---|
| 63 | void discontinuity_constraint(MxVertexID, MxVertexID, const MxFaceList&);
|
---|
| 64 | void compute_edge_info(edge_info *);
|
---|
| 65 | void finalize_edge_update(edge_info *);
|
---|
| 66 | void compute_target_placement(edge_info *);
|
---|
| 67 |
|
---|
| 68 | void apply_contraction(const MxPairContraction&, edge_info *);
|
---|
| 69 | void update_pre_contract(const MxPairContraction&);
|
---|
| 70 |
|
---|
| 71 | public:
|
---|
| 72 | bool will_decouple_quadrics;
|
---|
| 73 |
|
---|
| 74 | public:
|
---|
| 75 | MxPropSlim(MxStdModel *);
|
---|
| 76 |
|
---|
| 77 | uint dim() const { return D; }
|
---|
| 78 |
|
---|
| 79 | void consider_color(bool will=true);
|
---|
| 80 | void consider_texture(bool will=true);
|
---|
| 81 | void consider_normals(bool will=true);
|
---|
| 82 |
|
---|
| 83 | uint quadric_count() const { return __quadrics.length(); }
|
---|
| 84 | MxQuadric& quadric(uint i) { return *(__quadrics(i)); }
|
---|
| 85 | const MxQuadric& quadric(uint i) const { return *(__quadrics(i)); }
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | void initialize();
|
---|
| 89 | bool decimate(uint);
|
---|
| 90 |
|
---|
| 91 | };
|
---|
| 92 |
|
---|
| 93 | // MXPROPSLIM_INCLUDED
|
---|
| 94 | #endif
|
---|