furti / FreeCAD-Lithophane

FreeCAD Workbench to convert an image to a Lithophane for 3D Printing
MIT License
32 stars 7 forks source link

Image of Tube is flipped along the y axis #38

Closed AMitscher closed 2 years ago

AMitscher commented 3 years ago

Describe the bug When creating a Tube Lithophane the image is flipped along the y axis somewhere during the process. This is not expected and as a result text as an expample will be backwards.

To Reproduce Steps to reproduce the behavior:

  1. Import Image
  2. Create Tube Lithophane

Expected behavior I was expecting that the image does not change the orientation when creating a tube lithophane. This behaviour does not exist for the Box Lithophane

FreeCAD Version Info:

OS: Windows 10 Version 2009 Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19.24276 (Git) Build type: Release Branch: releases/FreeCAD-0-19 Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438 Python version: 3.8.6+ Qt version: 5.15.1 Coin version: 4.0.1 OCC version: 7.5.0 Locale: German/Germany (de_DE)

furti commented 2 years ago

Thanks for pointing this out. I pushed a fix for this. So if you update, the image should now be oriented correctly on the tube.

The Problem was, that the algorithm lays out the Vertices in clockwise order, starting from the positive X axis. This is important so that all Normals point in the right direction. And then it started with the leftmost pixel and worked its way to the end of the image. So the image was flipped. The new algorithm starts on the rightmost pixel and works his way to the start of the image. So the orientation is kept as it should be.