Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model.hpp Doxygen Documentation #3958

Merged
merged 14 commits into from Jun 16, 2017
Merged

Model.hpp Doxygen Documentation #3958

merged 14 commits into from Jun 16, 2017

Conversation

Samir55
Copy link
Member

@Samir55 Samir55 commented May 17, 2017

No description provided.

Copy link
Member

@alranel alranel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Just a few notes.

ModelObjectPtrs objects;

///< Objects are owned by a model. Each model may have multiple instances
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each object may have multiple instances.

~Model();

/// Read a model from file.
/// This function supports the following formats (STL, OBJ, AMF).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth documenting that this method auto-detects the file format by looking at the filename suffix. It's also useful to state that the file path supplied to this method must be expressed in UTF-8.

void repair();

/// Center each model object instance around a point.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No! It centers the total bounding box of the instances, not each single instance. Otherwise they would placed in the same spot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth specifying that this only works in the XY plane and no transformation in Z is performed.

void center_instances_around_point(const Pointf &point);

/// Center each ModelObject instance around the origin point.
void align_instances_to_origin();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this method is badly named (you described its behavior correctly) and you can remove it. Also remove it from Model.xsp please, otherwise it doesn't compile.

void translate(coordf_t x, coordf_t y, coordf_t z);

/// Flatten all ModelObjects of the current model to a single mesh
/// after performing extra transformations (if the model was rotated or translated).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be worded better. It flattens all ModelInstances to a single mesh. Beware of expressions like "extra transformations", as users who read this API docs might wonder what they are. They are instance transformations, so let's call them that way without introducing a new term.

void scale_to_fit(const Sizef3 &size);

/// Rotate the current ModelObject.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify whether this rotates the volume meshes or just alters the instance attributes.

void mirror(const Axis &axis);

/// Transform the current ModelObject by a certain ModelInstance attributes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's important to document that the inverse transformation is applied to all the object instances, so that the final size/position/rotation of the transformed objects doesn't change. This method is useful for flattening the instance transformations (of one instance) to the mesh.

size_t facets_count() const;

/// Know whether there exists a TriangleMesh object that needs repair or not.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...that needed repair.

bool needed_repair() const;

/// Cut (Slice) the current ModelObject at a certain axis at a certain magnitude.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just English notes: along a certain axis at a certain coordinate.

/// Cut (Slice) the current ModelObject at a certain axis at a certain magnitude.
/// \param axis Axis the axis to slice at (X = 0 or Y or Z)
/// \param z coordf_t the point at the certain axis to cut(slice) the Model at
/// \param model the owner Model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Model which will get the resulting objects added. It can be the same model as the input one, or another one.

@lordofhyphens
Copy link
Member

As a FYI, Markdown syntax is supported with Doxygen. Don't feel as if you have to use it.

@lordofhyphens lordofhyphens added the Code Cleanup/Refactoring This is a cleanup/refactor effort that should not affect functionality. label May 21, 2017
@lordofhyphens lordofhyphens added this to the GSOC 2017 milestone May 21, 2017
Samir55 and others added 6 commits May 24, 2017 15:57
Put back align_instances_to_origin. Not sure why this was removed to start with.
put back removed function (this should be a doc-only change)
Re-added function that should have not been removed in a doc-only change (re: scope)
Copy link
Member

@lordofhyphens lordofhyphens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved my own comments.

ModelMaterial* add_material(t_model_material_id material_id, const ModelMaterial &other);

/// Get theModelMaterial having a certain material id.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Need a space between "the" and "ModelMaterial"

this->center_instances_around_point(new_center);
}

void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So where did this go?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexrj told me to remove it from Model.

@lordofhyphens lordofhyphens dismissed alranel’s stale review June 16, 2017 02:17

Changes were made to address review.

@lordofhyphens lordofhyphens merged commit 1e8cd3f into slic3r:master Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup/Refactoring This is a cleanup/refactor effort that should not affect functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants