- improved rotation point finding behavior. not sure what did I even do to improve it...

Fri, 10 Jan 2014 15:28:29 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 10 Jan 2014 15:28:29 +0200
changeset 614
aac6f0021070
parent 613
2d01590da286
child 615
b9073bddec0d

- improved rotation point finding behavior. not sure what did I even do to improve it...

ldforge.pro file | annotate | diff | comparison | revisions
src/gui.cc file | annotate | diff | comparison | revisions
src/gui_editactions.cc file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/misc.cc file | annotate | diff | comparison | revisions
src/types.cc file | annotate | diff | comparison | revisions
--- a/ldforge.pro	Fri Jan 10 11:09:38 2014 +0200
+++ b/ldforge.pro	Fri Jan 10 15:28:29 2014 +0200
@@ -25,8 +25,8 @@
 }
 
 exists(.git): DEFINES += GIT_DESCRIBE="\"\\\"$$system(git describe --tags --long)\\\"\""
-DEFINES += COMPILE_DATE="\"\\\"$$system(LC_ALL=C date \"+%d %h %Y %H:%M:%S\")\\\"\""
 
 unix {
 	LIBS += -lGLU
+	DEFINES += COMPILE_DATE="\"\\\"$$system(LC_ALL=C date \"+%d %h %Y %H:%M:%S\")\\\"\""
 }
--- a/src/gui.cc	Fri Jan 10 11:09:38 2014 +0200
+++ b/src/gui.cc	Fri Jan 10 15:28:29 2014 +0200
@@ -285,7 +285,9 @@
 	title += " [pre-release build]";
 #endif // DEBUG
 
+#ifdef COMPILE_DATE
 	title += " (built " COMPILE_DATE ")";
+#endif // COMPILE_DATE
 
 	setWindowTitle (title);
 }
--- a/src/gui_editactions.cc	Fri Jan 10 11:09:38 2014 +0200
+++ b/src/gui_editactions.cc	Fri Jan 10 15:28:29 2014 +0200
@@ -471,6 +471,8 @@
 				 cosangle = cos (angle),
 				 sinangle = sin (angle);
 
+	log ("rotpoint: %1", rotpoint);
+
 	// ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2
 	Matrix transform (
 	{
--- a/src/main.h	Fri Jan 10 11:09:38 2014 +0200
+++ b/src/main.h	Fri Jan 10 15:28:29 2014 +0200
@@ -44,11 +44,6 @@
 #define BUILD_RELEASE	1
 
 // =============================================
-#ifndef COMPILE_DATE
-# error COMPILE_DATE is not set (qmake should have done this)
-#endif // COMPILE_DATE
-
-// =============================================
 #ifdef DEBUG
 # undef RELEASE
 #endif // DEBUG
--- a/src/misc.cc	Fri Jan 10 11:09:38 2014 +0200
+++ b/src/misc.cc	Fri Jan 10 15:28:29 2014 +0200
@@ -211,18 +211,20 @@
 // -----------------------------------------------------------------------------
 Vertex rotPoint (const QList<LDObject*>& objs)
 {
-	LDBoundingBox box;
-
 	switch (edit_rotpoint)
 	{
 		case ObjectOrigin:
 		{
+			LDBoundingBox box;
+
 			// Calculate center vertex
 			for (LDObject* obj : objs)
+			{
 				if (obj->hasMatrix())
 					box << dynamic_cast<LDMatrixObject*> (obj)->getPosition();
 				else
 					box << obj;
+			}
 
 			return box.center();
 		}
--- a/src/types.cc	Fri Jan 10 11:09:38 2014 +0200
+++ b/src/types.cc	Fri Jan 10 15:28:29 2014 +0200
@@ -388,11 +388,8 @@
 {
 	for_axes (ax)
 	{
-		if (v[ax] < m_Vertex0[ax])
-			m_Vertex0[ax] = v[ax];
-
-		if (v[ax] > m_Vertex1[ax])
-			m_Vertex1[ax] = v[ax];
+		m_Vertex0[ax] = min (v[ax], m_Vertex0[ax]);
+		m_Vertex1[ax] = max (v[ax], m_Vertex1[ax]);
 	}
 
 	setEmpty (false);
@@ -402,9 +399,8 @@
 // -----------------------------------------------------------------------------
 void LDBoundingBox::reset()
 {
-	m_Vertex0[X] = m_Vertex0[Y] = m_Vertex0[Z] = 0x7FFFFFFF;
-	m_Vertex1[X] = m_Vertex1[Y] = m_Vertex1[Z] = 0xFFFFFFFF;
-
+	m_Vertex0[X] = m_Vertex0[Y] = m_Vertex0[Z] = 10000.0;
+	m_Vertex1[X] = m_Vertex1[Y] = m_Vertex1[Z] = -10000.0;
 	setEmpty (true);
 }
 

mercurial