libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd configure configure.in cvd/draw.h cvd_sr...


From: Edward Rosten
Subject: [libcvd-members] libcvd configure configure.in cvd/draw.h cvd_sr...
Date: Tue, 24 Mar 2009 14:17:11 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Edward Rosten <edrosten>        09/03/24 14:17:11

Modified files:
        .              : configure configure.in 
        cvd            : draw.h 
Added files:
        cvd_src        : draw_toon.cc 

Log message:
        Useful drawing function

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/configure?cvsroot=libcvd&r1=1.142&r2=1.143
http://cvs.savannah.gnu.org/viewcvs/libcvd/configure.in?cvsroot=libcvd&r1=1.143&r2=1.144
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/draw.h?cvsroot=libcvd&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/draw_toon.cc?cvsroot=libcvd&rev=1.1

Patches:
Index: configure
===================================================================
RCS file: /cvsroot/libcvd/libcvd/configure,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -b -r1.142 -r1.143
--- configure   12 Mar 2009 23:06:53 -0000      1.142
+++ configure   24 Mar 2009 14:17:06 -0000      1.143
@@ -12224,6 +12224,7 @@
 
 #Numerics dependencies
 cvd_src/tensor_voting,cvd_src/brezenham                        toon END
+cvd_src/draw_toon                                      toon END
 
 ENDDEPS
 

Index: configure.in
===================================================================
RCS file: /cvsroot/libcvd/libcvd/configure.in,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- configure.in        12 Mar 2009 23:06:54 -0000      1.143
+++ configure.in        24 Mar 2009 14:17:09 -0000      1.144
@@ -1024,6 +1024,7 @@
 
 #Numerics dependencies
 cvd_src/tensor_voting,cvd_src/brezenham                        toon END
+cvd_src/draw_toon                                      toon END
 
 ENDDEPS
 

Index: cvd/draw.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/draw.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- cvd/draw.h  5 Jan 2009 15:55:09 -0000       1.10
+++ cvd/draw.h  24 Mar 2009 14:17:10 -0000      1.11
@@ -226,6 +226,17 @@
 std::vector<ImageRef> getDisc(float radius);
 
 
+#if defined CVD_HAVE_TOON || defined DOXYGEN_IGNORE_INTERNAL
+/// returns coordinates for a solid ellipse origin. The result can be
+/// used with drawShape to draw it into an image. 
+/// @param r1 First radius
+/// @param r2 Second radius
+/// @param theta Orientation of the ellipse
+/// @return vector containig ImageRef for the ellipse
+/// @ingroup gGraphics
+std::vector<ImageRef> getSolidEllipse(float r1, float r2, float theta);
+#endif
+
 /// joins two images side-by-side to create a larger image, any remaining 
empty region will be blacked out
 /// @param a input image a to copy from
 /// @param b input image b to copy from

Index: cvd_src/draw_toon.cc
===================================================================
RCS file: cvd_src/draw_toon.cc
diff -N cvd_src/draw_toon.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cvd_src/draw_toon.cc        24 Mar 2009 14:17:10 -0000      1.1
@@ -0,0 +1,53 @@
+/*
+        This file is part of the CVD Library.
+
+        Copyright (C) 2005 The Authors
+
+        This library is free software; you can redistribute it and/or
+        modify it under the terms of the GNU Lesser General Public
+        License as published by the Free Software Foundation; either
+        version 2.1 of the License, or (at your option) any later version.
+
+        This library is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+        Lesser General Public License for more details.
+
+        You should have received a copy of the GNU Lesser General Public
+        License along with this library; if not, write to the Free Software
+        Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include <cvd/draw.h>
+#include <utility>
+#include <TooN/helpers.h>
+using namespace TooN;
+using namespace std;
+
+namespace CVD {
+
+static double len2(const Vector<2>& v)
+{
+       return v*v;
+}      
+
+
+vector<ImageRef> getSolidEllipse(float r1, float r2, float theta)
+{
+       vector<ImageRef> e;
+
+       int r = (int) ceil(max(r1, r2) + 1);
+       Matrix<2> t;
+       t[0] =  makeVector(cos(theta), sin(theta)) / r1;
+       t[1] =  makeVector(-sin(theta), cos(theta)) / r2;
+
+
+       for(int y=-r; y <= r; y++)
+               for(int x=-r; x <= r; x++)
+                       if(len2(t * makeVector(x, y)) <= 1)
+                               e.push_back(ImageRef(x, y));
+       return e;
+}
+
+};




reply via email to

[Prev in Thread] Current Thread [Next in Thread]