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

Porting geometry.t to catch #36

Closed
TheThirdOne opened this issue Jul 15, 2018 · 5 comments
Closed

Porting geometry.t to catch #36

TheThirdOne opened this issue Jul 15, 2018 · 5 comments
Assignees

Comments

@TheThirdOne
Copy link

Part of working on #33

I've got a solid start on converting it. Many of the basic tests that are already supported by libslic3r have been ported and confirmed to work. I haven't translated anything into libslic3r yet though.

@TheThirdOne
Copy link
Author

All of the tests that don't need anything extra translated are done and passing.

I took a look at most of the code that I will need to translate and tried to understand how it works and where it is used.

Slic3r::Geometry::line_intersection is a bit strange. At first I assumed that it was just the libslic3r method on Slic3r::Line, but instead it is implemented in perl. And it appears the only place outside Geometry.pm that is is used is in Line.pm. And in turn that appears to only be used in arc fitting code. Presumably this means that all of the code mentioned can be replaced by a single line and an addition to xsp. I don't know how to confirm that its only used there though, so I don't feel comfortable going ahead deleting it.

Slic3r::Geometry::polygon_is_convex appears to be entirely unused besides tests. Slic3r::Geometry::point_in_segment appears to only be used in Geometry.pm in methods that are unused as well as tests. A few of the other methods tested also appear to be unused (or almost unused).

@lordofhyphens, any suggestions on how to test to confirm that they are actually never used anywhere in the code?

@lordofhyphens
Copy link
Owner

For figuring out if it's used or not, grep is probably the one-off "hey who calls what" I'd use, working your way up the call stack. For things on the perl side, you'd want to check the xsp files if you suspect it's in libslic3r. There are commercial programs for doing source code analysis (Understand from SciTools is one my coworkers use).

AFAIK the arc fitting code isn't used in Slic3r anymore (it was for G2/G3 gcode generation).

@TheThirdOne
Copy link
Author

The arc fitting still has a config option to turn it on, but upon trying to export gcode, it fails.

I took a close look through Geometry.pm to see what methods are completely unused. More than half is completely unused. ArcFitting.pm is then uses a few methods otherwise not called.

Aside from methods used only by ArcFitting.pm, only Line::grow is left to get the test working on.

@lordofhyphens
Copy link
Owner

I'd leave them be for now, then.

Paste the unused functions into Geometry.cpp and comment them out (with /* */). If we need them, we can port them later.

@TheThirdOne
Copy link
Author

Didn't get much done today, but the tests are all converted besides the unused methods and angle3points test (used in ArcFitting).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants