mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-09-13 06:03:13 +08:00
fixed spelling mistakes in comments (#104)
This commit is contained in:
parent
67600aa521
commit
ecdd29e44b
@ -123,7 +123,7 @@ bool MeshPredictionSchemeConstrainedMultiParallelogram<
|
||||
std::vector<DataTypeT> predicted_value;
|
||||
};
|
||||
|
||||
// Bit-field used for computing permutations of exlcluded edges
|
||||
// Bit-field used for computing permutations of excluded edges
|
||||
// (parallelograms).
|
||||
bool exluded_parallelograms[kMaxNumParallelograms];
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace draco {
|
||||
// Parallelogram prediction predicts an attribute value V from three vertices
|
||||
// on the opposite face to the predicted vertex. The values on the three
|
||||
// vertices are used to construct a parallelogram V' = O - A - B, where O is the
|
||||
// value on the oppoiste vertex, and A, B are values on the shared vertices:
|
||||
// value on the opposite vertex, and A, B are values on the shared vertices:
|
||||
// V
|
||||
// / \
|
||||
// / \
|
||||
|
@ -29,7 +29,7 @@ typedef RAnsBitDecoder BinaryDecoder;
|
||||
typedef RAnsBitEncoder BinaryEncoder;
|
||||
|
||||
// Prediction scheme designed for predicting texture coordinates from known
|
||||
// spatial position of vertices. For good parameterizations, the ratios between
|
||||
// spatial position of vertices. For good parametrization, the ratios between
|
||||
// triangle edge lengths should be about the same in both the spatial and UV
|
||||
// coordinate spaces, which makes the positions a good predictor for the UV
|
||||
// coordinates.
|
||||
@ -243,7 +243,7 @@ void MeshPredictionSchemeTexCoords<DataTypeT, TransformT, MeshDataT>::
|
||||
const Vector3f prev_pos = GetPositionForEntryId(prev_data_id);
|
||||
// Use the positions of the above triangle to predict the texture coordinate
|
||||
// on the tip corner C.
|
||||
// Convert the triangle into a new coordinate system defined by orthoganal
|
||||
// Convert the triangle into a new coordinate system defined by orthogonal
|
||||
// bases vectors S, T, where S is vector prev_pos - next_pos and T is an
|
||||
// perpendicular vector to S in the same plane as vector the
|
||||
// tip_pos - next_pos.
|
||||
|
@ -37,7 +37,7 @@ CreatePredictionSchemeForDecoder(PredictionSchemeMethod method, int att_id,
|
||||
// Cast the decoder to mesh decoder. This is not necessarily safe if there
|
||||
// is some other decoder decides to use TRIANGULAR_MESH as the return type,
|
||||
// but unfortunately there is not nice work around for this without using
|
||||
// RTTI (double dispatch and similar conecepts will not work because of the
|
||||
// RTTI (double dispatch and similar concepts will not work because of the
|
||||
// template nature of the prediction schemes).
|
||||
const MeshDecoder *const mesh_decoder =
|
||||
static_cast<const MeshDecoder *>(decoder);
|
||||
|
@ -47,7 +47,7 @@ CreatePredictionSchemeForEncoder(PredictionSchemeMethod method, int att_id,
|
||||
// Cast the encoder to mesh encoder. This is not necessarily safe if there
|
||||
// is some other encoder decides to use TRIANGULAR_MESH as the return type,
|
||||
// but unfortunately there is not nice work around for this without using
|
||||
// RTTI (double dispatch and similar conecepts will not work because of the
|
||||
// RTTI (double dispatch and similar concepts will not work because of the
|
||||
// template nature of the prediction schemes).
|
||||
const MeshEncoder *const mesh_encoder =
|
||||
static_cast<const MeshEncoder *>(encoder);
|
||||
|
@ -26,9 +26,9 @@ namespace draco {
|
||||
|
||||
// The transform works on octahedral coordinates for normals. The square is
|
||||
// subdivided into four inner triangles (diamond) and four outer triangles. The
|
||||
// inner trianlges are associated with the upper part of the octahedron and the
|
||||
// inner triangles are associated with the upper part of the octahedron and the
|
||||
// outer triangles are associated with the lower part.
|
||||
// Given a preditiction value P and the actual value Q that should be encoded,
|
||||
// Given a prediction value P and the actual value Q that should be encoded,
|
||||
// this transform first checks if P is outside the diamond. If so, the outer
|
||||
// triangles are flipped towards the inside and vice versa. Then it checks if p
|
||||
// is in the bottom left quadrant. If it is not, it rotates p and q accordingly.
|
||||
@ -36,7 +36,7 @@ namespace draco {
|
||||
// values. The inversion tends to result in shorter correction vectors and the
|
||||
// rotation makes it so that all long correction values are positive, reducing
|
||||
// the possible value range of the correction values and increasing the
|
||||
// occurence of positive large correction values, which helps the entropy
|
||||
// occurrences of positive large correction values, which helps the entropy
|
||||
// encoder. This is possible since P is also known by the decoder, see also
|
||||
// ComputeCorrection and ComputeOriginalValue functions.
|
||||
// Note that the tile is not periodic, which implies that the outer edges can
|
||||
|
@ -26,9 +26,9 @@ namespace draco {
|
||||
|
||||
// The transform works on octahedral coordinates for normals. The square is
|
||||
// subdivided into four inner triangles (diamond) and four outer triangles. The
|
||||
// inner trianlges are associated with the upper part of the octahedron and the
|
||||
// inner triangles are associated with the upper part of the octahedron and the
|
||||
// outer triangles are associated with the lower part.
|
||||
// Given a preditiction value P and the actual value Q that should be encoded,
|
||||
// Given a prediction value P and the actual value Q that should be encoded,
|
||||
// this transform first checks if P is outside the diamond. If so, the outer
|
||||
// triangles are flipped towards the inside and vice versa. The actual
|
||||
// correction value is then based on the mapped P and Q values. This tends to
|
||||
|
@ -37,7 +37,7 @@ class PredictionSchemeTransform {
|
||||
return PREDICTION_TRANSFORM_DELTA;
|
||||
}
|
||||
|
||||
// Performs any custom initialization of the trasnform for the encoder.
|
||||
// Performs any custom initialization of the transform for the encoder.
|
||||
// |size| = total number of values in |orig_data| (i.e., number of entries *
|
||||
// number of components).
|
||||
void InitializeEncoding(const DataTypeT * /* orig_data */, int /* size */,
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace draco {
|
||||
|
||||
// Class encapsuling options used by PointCloudEncoder and its derived classes.
|
||||
// Class encapsulating options used by PointCloudEncoder and its derived classes.
|
||||
// The encoder can be controller through three different options:
|
||||
// 1. Global options
|
||||
// 2. Per attribute options - i.e., options specific to a given attribute.
|
||||
@ -34,7 +34,7 @@ class EncoderOptions {
|
||||
public:
|
||||
static EncoderOptions CreateDefaultOptions();
|
||||
|
||||
// Sets the global options that serve to control the overal behavior of an
|
||||
// Sets the global options that serve to control the overall behavior of an
|
||||
// encoder as well as a fallback for attribute options if they are not set.
|
||||
void SetGlobalOptions(const Options &o);
|
||||
Options *GetGlobalOptions() { return &global_options_; }
|
||||
|
@ -34,7 +34,7 @@ bool EncodeMeshToBuffer(const Mesh &m, const EncoderOptions &options,
|
||||
EncoderBuffer *out_buffer);
|
||||
|
||||
// Creates default encoding options that contain a valid set of features that
|
||||
// the encoder can use. Otherwise all options are left unitialized which results
|
||||
// the encoder can use. Otherwise all options are left uninitialized which results
|
||||
// in a lossless compression.
|
||||
EncoderOptions CreateDefaultEncoderOptions();
|
||||
|
||||
@ -93,7 +93,7 @@ void SetEncodingMethod(EncoderOptions *options, int encoding_method);
|
||||
// Sets the desired prediction method for a given attribute. By default,
|
||||
// prediction scheme is selected automatically by the encoder using other
|
||||
// provided options (such as speed) and input geometry type (mesh, point cloud).
|
||||
// This function should be called only when a specific prediction is prefered
|
||||
// This function should be called only when a specific prediction is preferred
|
||||
// (e.g., when it is known that the encoder would select a less optimal
|
||||
// prediction for the given input data).
|
||||
//
|
||||
|
@ -619,7 +619,7 @@ int MeshEdgeBreakerDecoderImpl<TraversalDecoder>::DecodeConnectivity(
|
||||
// \ / \b/ \ /
|
||||
// *-------*-------*
|
||||
//
|
||||
// TODO(ostava): The ciruclation below should be replaced by functions
|
||||
// TODO(ostava): The circulation below should be replaced by functions
|
||||
// that can be reused elsewhere.
|
||||
CornerIndex corner_b = corner_table_->Previous(corner);
|
||||
while (corner_table_->Opposite(corner_b) >= 0) {
|
||||
@ -660,7 +660,7 @@ int MeshEdgeBreakerDecoderImpl<TraversalDecoder>::DecodeConnectivity(
|
||||
}
|
||||
}
|
||||
if (num_faces != corner_table_->num_faces())
|
||||
return -1; // Unexcpected number of decoded faces.
|
||||
return -1; // Unexpected number of decoded faces.
|
||||
vertex_id_map_.resize(num_vertices);
|
||||
return num_vertices;
|
||||
}
|
||||
@ -847,7 +847,7 @@ bool MeshEdgeBreakerDecoderImpl<TraversalDecoder>::AssignPointsToCorners() {
|
||||
// Do a deduplication pass over the corners on the processed vertex.
|
||||
// At this point each corner corresponds to one point id and our goal is to
|
||||
// merge similar points into a single point id.
|
||||
// We do one one pass in a clocwise direction over the corners and we add
|
||||
// We do one one pass in a clockwise direction over the corners and we add
|
||||
// a new point id whenever one of the attributes change.
|
||||
c = deduplication_first_corner;
|
||||
// Create a new point.
|
||||
|
@ -76,7 +76,7 @@ class MeshEdgeBreakerDecoderImpl : public MeshEdgeBreakerDecoderImplInterface {
|
||||
// Returns the number of vertices created by the decoder or -1 on error.
|
||||
int DecodeConnectivity(int num_symbols);
|
||||
|
||||
// Returns true if the current symbol was part of a topolgy split event. This
|
||||
// Returns true if the current symbol was part of a topology split event. This
|
||||
// means that the current face was connected to the left edge of a face
|
||||
// encoded with the TOPOLOGY_S symbol. |out_symbol_edge| can be used to
|
||||
// identify which edge of the source symbol was connected to the TOPOLOGY_S
|
||||
|
@ -188,7 +188,7 @@ bool MeshEdgeBreakerEncoderImpl<TraversalEncoder>::GenerateAttributesEncoder(
|
||||
new SequentialAttributeEncodersController(std::move(sequencer), att_id));
|
||||
|
||||
// Update the mapping between the encoder id and the attribute data id.
|
||||
// This will be used by the decoder to select the approperiate attribute
|
||||
// This will be used by the decoder to select the appropriate attribute
|
||||
// decoder and the correct connectivity.
|
||||
attribute_encoder_to_data_id_map_.push_back(att_data_id);
|
||||
GetEncoder()->AddAttributesEncoder(std::move(att_controller));
|
||||
|
@ -97,13 +97,13 @@ enum EdgeFaceName : uint8_t { LEFT_FACE_EDGE = 0, RIGHT_FACE_EDGE = 1 };
|
||||
|
||||
// Struct used for storing data about a source face that connects to an
|
||||
// already traversed face that was either the initial face or a face encoded
|
||||
// with either toplogy S (split) symbol. Such connection can be only caused by
|
||||
// with either topology S (split) symbol. Such connection can be only caused by
|
||||
// topology changes on the traversed surface (if its genus != 0, i.e. when the
|
||||
// surface has topological handles or holes).
|
||||
// For each occurence of such event we always encode the split symbol id, source
|
||||
// symbol id and source edge id (left, or right). There will be always exectly
|
||||
// two occurences of this event for every topological handle on the traversed
|
||||
// mesh and one occurence for a hole.
|
||||
// For each occurrence of such event we always encode the split symbol id, source
|
||||
// symbol id and source edge id (left, or right). There will be always exactly
|
||||
// two occurrences of this event for every topological handle on the traversed
|
||||
// mesh and one occurrence for a hole.
|
||||
struct TopologySplitEventData {
|
||||
int32_t split_symbol_id;
|
||||
int32_t source_symbol_id;
|
||||
|
@ -22,7 +22,7 @@ namespace draco {
|
||||
// Encoder that tries to predict the edgebreaker traversal symbols based on the
|
||||
// vertex valences of the unencoded portion of the mesh. The current prediction
|
||||
// scheme assumes that each vertex has valence 6 which can be used to predict
|
||||
// the symbol preceeding the one that is currently encoded. Predictions are
|
||||
// the symbol preceding the one that is currently encoded. Predictions are
|
||||
// encoded using an arithmetic coding which can lead to less than 1 bit per
|
||||
// triangle encoding for highly regular meshes.
|
||||
class MeshEdgeBreakerTraversalPredictiveEncoder
|
||||
@ -84,10 +84,10 @@ class MeshEdgeBreakerTraversalPredictiveEncoder
|
||||
// Whenever we reach a split symbol, mark its tip vertex as invalid by
|
||||
// setting the valence to a negative value. Any prediction that will
|
||||
// use this vertex will then cause a misprediction. This is currently
|
||||
// necessary because the decodding works in the reverse direction and
|
||||
// necessary because the decoding works in the reverse direction and
|
||||
// the decoder doesn't know about these vertices until the split
|
||||
// symbol is decoded at which point two vertices are merged into one.
|
||||
// This can be most likely solved on the encoder side by spliting the
|
||||
// This can be most likely solved on the encoder side by splitting the
|
||||
// tip vertex into two, but since split symbols are relatively rare,
|
||||
// it's probably not worth doing it.
|
||||
vertex_valences_[corner_table_->Vertex(last_corner_).value()] = -1;
|
||||
|
@ -63,7 +63,7 @@ class MeshEdgeBreakerTraversalValenceEncoder
|
||||
|
||||
// Replicate the corner to vertex map from the corner table. We need to do
|
||||
// this because the map may get updated during encoding because we add new
|
||||
// vertices when we encouter split symbols.
|
||||
// vertices when we encounter split symbols.
|
||||
corner_to_vertex_map_.resize(corner_table_->num_corners());
|
||||
for (CornerIndex i(0); i < corner_table_->num_corners(); ++i) {
|
||||
corner_to_vertex_map_[i] = corner_table_->Vertex(i);
|
||||
|
@ -22,7 +22,7 @@
|
||||
namespace draco {
|
||||
|
||||
// Abstract base class for all point cloud and mesh decoders. It provides a
|
||||
// basic funcionality that is shared between different decoders.
|
||||
// basic functionality that is shared between different decoders.
|
||||
class PointCloudDecoder {
|
||||
public:
|
||||
PointCloudDecoder();
|
||||
@ -30,7 +30,7 @@ class PointCloudDecoder {
|
||||
|
||||
virtual EncodedGeometryType GetGeometryType() const { return POINT_CLOUD; }
|
||||
|
||||
// Decodes a Draco header int othe provided |out_header|.
|
||||
// Decodes a Draco header int other provided |out_header|.
|
||||
// Returns false on error.
|
||||
static bool DecodeHeader(DecoderBuffer *buffer, DracoHeader *out_header);
|
||||
|
||||
|
@ -153,7 +153,7 @@ bool PointCloudEncoder::RearrangeAttributesEncoders() {
|
||||
// Find the encoding order of the attribute encoders that is determined by
|
||||
// the parent dependencies between individual encoders. Instead of traversing
|
||||
// a graph we encode the attributes in multiple iterations where encoding of
|
||||
// attributes that depend on other attributes may get posponed until the
|
||||
// attributes that depend on other attributes may get postponed until the
|
||||
// parent attributes are processed.
|
||||
// This is simpler to implement than graph traversal and it automatically
|
||||
// detects any cycles in the dependency graph.
|
||||
|
@ -24,7 +24,7 @@
|
||||
namespace draco {
|
||||
|
||||
// Abstract base class for all point cloud and mesh encoders. It provides a
|
||||
// basic funcionality that's shared between different encoders.
|
||||
// basic functionality that's shared between different encoders.
|
||||
class PointCloudEncoder {
|
||||
public:
|
||||
PointCloudEncoder();
|
||||
|
@ -30,7 +30,7 @@ inline uint8_t clamp_probability(double p) {
|
||||
return static_cast<uint8_t>(p_int);
|
||||
}
|
||||
|
||||
// Update the probablity according to new incoming bit.
|
||||
// Update the probability according to new incoming bit.
|
||||
inline double update_probability(double old_p, bool bit) {
|
||||
static constexpr double w = 128.0;
|
||||
static constexpr double w0 = (w - 1.0) / w;
|
||||
|
@ -33,7 +33,7 @@ class AdaptiveRAnsBitDecoder {
|
||||
// Sets |source_buffer| as the buffer to decode bits from.
|
||||
bool StartDecoding(DecoderBuffer *source_buffer);
|
||||
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwsie false.
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwise false.
|
||||
bool DecodeNextBit();
|
||||
|
||||
// Decode the next |nbits| and return the sequence in |value|. |nbits| must be
|
||||
|
@ -30,7 +30,7 @@ void AdaptiveRAnsBitEncoder::EndEncoding(EncoderBuffer *target_buffer) {
|
||||
AnsCoder ans_coder;
|
||||
ans_write_init(&ans_coder, buffer.data());
|
||||
|
||||
// Unfortunaetly we have to encode the bits in reversed order, while the
|
||||
// Unfortunately we have to encode the bits in reversed order, while the
|
||||
// probabilities that should be given are those of the forward sequence.
|
||||
double p0_f = 0.5;
|
||||
std::vector<uint8_t> p0s;
|
||||
|
@ -50,7 +50,7 @@ inline void CopyBits32(uint32_t *dst, int dst_offset, uint32_t src,
|
||||
|
||||
// Returns the most location of the most significant bit in the input integer
|
||||
// |n|.
|
||||
// The funcionality is not defined for |n == 0|.
|
||||
// The functionality is not defined for |n == 0|.
|
||||
inline int MostSignificantBit(uint32_t n) {
|
||||
#if defined(__GNUC__)
|
||||
return 31 ^ __builtin_clz(n);
|
||||
|
@ -33,7 +33,7 @@ class DecoderBuffer {
|
||||
DecoderBuffer &operator=(const DecoderBuffer &buf) = default;
|
||||
|
||||
// Sets the buffer's internal data. Note that no copy of the input data is
|
||||
// made so the data owner needs to keep the data valid and unchaged for
|
||||
// made so the data owner needs to keep the data valid and unchanged for
|
||||
// runtime of the decoder.
|
||||
void Init(const char *data, size_t data_size);
|
||||
|
||||
@ -48,7 +48,7 @@ class DecoderBuffer {
|
||||
void EndBitDecoding();
|
||||
|
||||
// Decodes up to 32 bits into out_val. Can be called only in between
|
||||
// StartBitDecoding and EndBitDeoding. Otherwise returns false.
|
||||
// StartBitDecoding and EndBitDecoding. Otherwise returns false.
|
||||
bool DecodeLeastSignificantBits32(int nbits, uint32_t *out_value) {
|
||||
if (!bit_decoder_active())
|
||||
return false;
|
||||
@ -95,7 +95,7 @@ class DecoderBuffer {
|
||||
// Discards #bytes from the input buffer.
|
||||
void Advance(int64_t bytes) { pos_ += bytes; }
|
||||
|
||||
// Moves the parsing position to a specific offset from the beggining of the
|
||||
// Moves the parsing position to a specific offset from the beginning of the
|
||||
// input data.
|
||||
void StartDecodingFrom(int64_t offset) { pos_ = offset; }
|
||||
|
||||
|
@ -30,7 +30,7 @@ class DirectBitDecoder {
|
||||
// Sets |source_buffer| as the buffer to decode bits from.
|
||||
bool StartDecoding(DecoderBuffer *source_buffer);
|
||||
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwsie false.
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwise false.
|
||||
bool DecodeNextBit() {
|
||||
const uint32_t selector = 1 << (31 - num_used_bits_);
|
||||
const bool bit = *pos_ & selector;
|
||||
|
@ -45,7 +45,7 @@
|
||||
//
|
||||
// Strongly typed indices support most of the common binary and unary
|
||||
// operators and support for additional operators can be added if
|
||||
// necesssary.
|
||||
// necessary.
|
||||
|
||||
#ifndef DRACO_CORE_DRACO_INDEX_TYPE_H_
|
||||
#define DRACO_CORE_DRACO_INDEX_TYPE_H_
|
||||
@ -166,7 +166,7 @@ std::ostream &operator<<(std::ostream &os, IndexType<ValueTypeT, TagT> index) {
|
||||
|
||||
} // namespace draco
|
||||
|
||||
// Specialize std::hash for the stongly indexed types.
|
||||
// Specialize std::hash for the strongly indexed types.
|
||||
namespace std {
|
||||
|
||||
template <class ValueTypeT, class TagT>
|
||||
|
@ -23,7 +23,7 @@
|
||||
namespace draco {
|
||||
|
||||
// Class representing a buffer that can be used for either for byte-aligned
|
||||
// encoding of arbitrary data structures or for encoding of varialble-length
|
||||
// encoding of arbitrary data structures or for encoding of variable-length
|
||||
// bit data.
|
||||
class EncoderBuffer {
|
||||
public:
|
||||
|
@ -33,7 +33,7 @@ class RAnsBitDecoder {
|
||||
// Returns false when the data is invalid.
|
||||
bool StartDecoding(DecoderBuffer *source_buffer);
|
||||
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwsie false.
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwise false.
|
||||
bool DecodeNextBit();
|
||||
|
||||
// Decode the next |nbits| and return the sequence in |value|. |nbits| must be
|
||||
|
@ -16,7 +16,7 @@ class SymbolBitDecoder {
|
||||
// Sets |source_buffer| as the buffer to decode bits from.
|
||||
bool StartDecoding(DecoderBuffer *source_buffer);
|
||||
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwsie false.
|
||||
// Decode one bit. Returns true if the bit is a 1, otherwise false.
|
||||
bool DecodeNextBit();
|
||||
|
||||
// Decode the next |nbits| and return the sequence in |value|. |nbits| must be
|
||||
|
@ -179,7 +179,7 @@ CoeffT SquaredDistance(const VectorD<CoeffT, dimension_t> v1,
|
||||
const VectorD<CoeffT, dimension_t> v2) {
|
||||
CoeffT difference;
|
||||
CoeffT squared_distance = 0;
|
||||
// Check each index seperately so difference is never negative and underflow
|
||||
// Check each index separately so difference is never negative and underflow
|
||||
// is avoided for unsigned types.
|
||||
for (int i = 0; i < dimension_t; ++i) {
|
||||
if (v1[i] >= v2[i]) {
|
||||
|
@ -356,7 +356,7 @@ bool ObjDecoder::ParseFace(bool *error) {
|
||||
++num_obj_faces_;
|
||||
}
|
||||
} else {
|
||||
// We are in the couting mode.
|
||||
// We are in the counting mode.
|
||||
// We need to determine how many triangles are in the obj face.
|
||||
// Go over the line and check how many gaps there are between non-empty
|
||||
// sub-strings.
|
||||
|
@ -41,7 +41,7 @@ class ObjDecoder {
|
||||
bool DecodeFromBuffer(DecoderBuffer *buffer, PointCloud *out_point_cloud);
|
||||
|
||||
// Flag that can be used to turn on/off deduplication of input values.
|
||||
// This should be disabled only when we are sure that the input data doesn not
|
||||
// This should be disabled only when we are sure that the input data does not
|
||||
// contain any duplicate entries.
|
||||
// Default: true
|
||||
void set_deduplicate_input_values(bool v) { deduplicate_input_values_ = v; }
|
||||
|
@ -30,7 +30,7 @@ bool ObjEncoder::EncodeToFile(const PointCloud &pc,
|
||||
const std::string &file_name) {
|
||||
std::ofstream file(file_name);
|
||||
if (!file)
|
||||
return false; // File coulnd't be opened.
|
||||
return false; // File could not be opened.
|
||||
// Encode the mesh into a buffer.
|
||||
EncoderBuffer buffer;
|
||||
if (!EncodeToBuffer(pc, &buffer))
|
||||
|
@ -26,7 +26,7 @@ bool PlyEncoder::EncodeToFile(const PointCloud &pc,
|
||||
const std::string &file_name) {
|
||||
std::ofstream file(file_name, std::ios::binary);
|
||||
if (!file)
|
||||
return false; // File coulnd't be opened.
|
||||
return false; // File couldn't be opened.
|
||||
// Encode the mesh into a buffer.
|
||||
EncoderBuffer buffer;
|
||||
if (!EncodeToBuffer(pc, &buffer))
|
||||
|
@ -53,7 +53,7 @@ class CornerTable {
|
||||
const IndexTypeVector<FaceIndex, FaceType> &faces);
|
||||
|
||||
// Initializes the CornerTable from provides set of indexed faces.
|
||||
// The input faces can represent a non-manifold topolgy, in which case the
|
||||
// The input faces can represent a non-manifold topology, in which case the
|
||||
// non-manifold edges and vertices are going to be split.
|
||||
bool Initialize(const IndexTypeVector<FaceIndex, FaceType> &faces);
|
||||
|
||||
@ -157,7 +157,7 @@ class CornerTable {
|
||||
return Next(Opposite(Next(corner)));
|
||||
}
|
||||
|
||||
// Get opposite corners on the left and right faces respecitively (see image
|
||||
// Get opposite corners on the left and right faces respectively (see image
|
||||
// below, where L and R are the left and right corners of a corner X.
|
||||
//
|
||||
// *-------*-------*
|
||||
@ -177,7 +177,7 @@ class CornerTable {
|
||||
}
|
||||
|
||||
// Returns the number of new vertices that were created as a result of
|
||||
// spliting of non-manifold vertices of the input geometry.
|
||||
// splitting of non-manifold vertices of the input geometry.
|
||||
int NumNewVertices() const { return num_vertices() - num_original_vertices_; }
|
||||
int NumOriginalVertices() const { return num_original_vertices_; }
|
||||
|
||||
@ -206,7 +206,7 @@ class CornerTable {
|
||||
SetOppositeCorner(corner_1, corner_0);
|
||||
}
|
||||
|
||||
// Updates mapping betweeh a corner and a vertex.
|
||||
// Updates mapping between a corner and a vertex.
|
||||
inline void MapCornerToVertex(CornerIndex corner_id, VertexIndex vert_id) {
|
||||
const FaceIndex face = Face(corner_id);
|
||||
faces_[face][LocalIndex(corner_id)] = vert_id;
|
||||
@ -284,7 +284,7 @@ class CornerTable {
|
||||
bool ComputeOppositeCorners(int *num_vertices);
|
||||
|
||||
// Computes the lookup map for going from a vertex to a corner. This method
|
||||
// can handle non-manifold vertices by spliting them into multiple manifold
|
||||
// can handle non-manifold vertices by splitting them into multiple manifold
|
||||
// vertices.
|
||||
bool ComputeVertexCorners(int num_vertices);
|
||||
|
||||
@ -412,7 +412,7 @@ class FaceAdjacencyIterator
|
||||
// Returns true when all adjacent faces have been visited.
|
||||
bool End() const { return corner_ < 0; }
|
||||
|
||||
// Proceeds to the next adjacen face if possible.
|
||||
// Proceeds to the next adjacent face if possible.
|
||||
void Next() { FindNextFaceNeighbor(); }
|
||||
|
||||
// std::iterator interface.
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace draco {
|
||||
|
||||
// Class providing the basic traversal funcionality needed by traversers (such
|
||||
// Class providing the basic traversal functionality needed by traverses (such
|
||||
// as the EdgeBreakerTraverser, see edgebreaker_traverser.h). It is used to
|
||||
// return the corner table that is used for the traversal, plus it provides a
|
||||
// basic book-keeping of visited faces and vertices during the traversal.
|
||||
|
@ -27,7 +27,7 @@ namespace draco {
|
||||
// arguments TraversalProcessorT, TraversalObserverT and EdgeBreakerObserverT.
|
||||
// TraversalProcessorT is used to provide infrastructure for handling of visited
|
||||
// vertices and faces, TraversalObserverT can be used to implement custom
|
||||
// callbacks for varous traversal events, and EdgeBreakerObserverT can be used
|
||||
// callbacks for various traversal events, and EdgeBreakerObserverT can be used
|
||||
// to provide handling of edgebreaker symbols.
|
||||
// TraversalProcessorT needs to define the type of the corner table as:
|
||||
//
|
||||
|
@ -55,7 +55,7 @@ class Mesh : public PointCloud {
|
||||
}
|
||||
|
||||
// Sets the total number of faces. Creates new empty faces or deletes
|
||||
// existings ones if necessary.
|
||||
// existing ones if necessary.
|
||||
void SetNumFaces(size_t num_faces) { faces_.resize(num_faces, Face()); }
|
||||
|
||||
FaceIndex::ValueType num_faces() const { return faces_.size(); }
|
||||
|
@ -135,7 +135,7 @@ bool MeshAreEquivalent::operator()(const Mesh &mesh0, const Mesh &mesh1) {
|
||||
DCHECK(att0->IsValid());
|
||||
DCHECK(att1->IsValid());
|
||||
|
||||
// Prepare blocks of memomry to hold data of corners for this attribute.
|
||||
// Prepare blocks of memory to hold data of corners for this attribute.
|
||||
std::unique_ptr<uint8_t[]> data0(new uint8_t[att0->byte_stride()]);
|
||||
std::unique_ptr<uint8_t[]> data1(new uint8_t[att0->byte_stride()]);
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace draco {
|
||||
|
||||
// Class for storing connectivity of mesh attributes. The connectivity is stored
|
||||
// as a difference from the base mesh's corner table, where the differences are
|
||||
// represnted by attribute seam edges. This class provides a basic funcionality
|
||||
// represented by attribute seam edges. This class provides a basic functionality
|
||||
// for detecting the seam edges for a given attribute and for traversing the
|
||||
// constrained corner table with the seam edges.
|
||||
class MeshAttributeCornerTable {
|
||||
@ -122,7 +122,7 @@ class MeshAttributeCornerTable {
|
||||
std::vector<VertexIndex> corner_to_vertex_map_;
|
||||
|
||||
// Map between vertices and their associated left most corners. A left most
|
||||
// corner is a corner that is adjecent to a boundary or an attribute seam from
|
||||
// corner is a corner that is adjacent to a boundary or an attribute seam from
|
||||
// right (i.e., SwingLeft from that corner will return an invalid corner). If
|
||||
// no such corner exists for a given vertex, then any corner attached to the
|
||||
// vertex can be used.
|
||||
|
@ -162,7 +162,7 @@ bool MeshCleanup::operator()(Mesh *mesh, const MeshCleanupOptions &options) {
|
||||
const PointIndex new_point_id = point_map[i];
|
||||
if (new_point_id < 0)
|
||||
continue;
|
||||
// Index of the currenlty processed attribut entry in the original
|
||||
// Index of the currently processed attribute entry in the original
|
||||
// mesh.
|
||||
const AttributeValueIndex original_entry_index =
|
||||
att->mapped_index(i);
|
||||
|
@ -157,14 +157,14 @@ class GeometryAttribute {
|
||||
// Returns the type of the attribute indicating the nature of the attribute.
|
||||
Type attribute_type() const { return attribute_type_; }
|
||||
void set_attribute_type(Type type) { attribute_type_ = type; }
|
||||
// Retruns the data type that is stored in the attrbute.
|
||||
// Returns the data type that is stored in the attribute.
|
||||
DataType data_type() const { return data_type_; }
|
||||
// Returns the number of components that are stored for each entry.
|
||||
// For position attrinute this is usually three (x,y,z),
|
||||
// while texture coordinates have two compontents (u,v).
|
||||
// For position attribute this is usually three (x,y,z),
|
||||
// while texture coordinates have two components (u,v).
|
||||
int8_t components_count() const { return components_count_; }
|
||||
// Indicates whether the data type should be normalized before interpretation,
|
||||
// that is, it should be devided by the max value of the data type.
|
||||
// that is, it should be divided by the max value of the data type.
|
||||
bool normalized() const { return normalized_; }
|
||||
// The buffer storing the entire data of the attribute.
|
||||
const DataBuffer *buffer() const { return buffer_; }
|
||||
@ -219,7 +219,7 @@ class GeometryAttribute {
|
||||
// The same as above but without a component specifier for input attribute.
|
||||
template <typename T, typename OutT, int OUT_CMPS>
|
||||
bool ConvertTypedValue(AttributeValueIndex att_index, OutT *out_value) const {
|
||||
// Selecte the right method to call based on the number of attribute
|
||||
// Select the right method to call based on the number of attribute
|
||||
// components.
|
||||
switch (components_count_) {
|
||||
case 1:
|
||||
|
@ -81,7 +81,7 @@ AttributeValueIndex::ValueType PointAttribute::DeduplicateValues(
|
||||
return -1; // Unsupported data type.
|
||||
}
|
||||
if (unique_vals == 0)
|
||||
return -1; // Unexcpected error.
|
||||
return -1; // Unexpected error.
|
||||
return unique_vals;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ void PointCloud::ApplyPointIdDeduplication(
|
||||
bool PointCloud::DeduplicateAttributeValues() {
|
||||
// Go over all attributes and create mapping between duplicate entries.
|
||||
if (num_points() == 0)
|
||||
return false; // Unexcpected attribute size.
|
||||
return false; // Unexpected attribute size.
|
||||
// Deduplicate all attributes.
|
||||
for (int32_t att_id = 0; att_id < num_attributes(); ++att_id) {
|
||||
if (!attribute(att_id)->DeduplicateValues(*attribute(att_id)))
|
||||
|
@ -140,7 +140,7 @@ TEST_F(PointCloudBuilderTest, MultiUse) {
|
||||
}
|
||||
|
||||
{
|
||||
// Use only a sub-set of data (offseted to avoid possible reuse of old
|
||||
// Use only a sub-set of data (offsetted to avoid possible reuse of old
|
||||
// data).
|
||||
builder.Start(4);
|
||||
const int pos_att_id =
|
||||
|
Loading…
x
Reference in New Issue
Block a user