Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » Applications created with U++ » GeoFun -- Plot Spirograph
GeoFun -- Plot Spirograph [message #39212] Thu, 28 February 2013 16:38 Go to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
Hi,

I have made small program to plot spirographs.

These are Roulette (curves).

Program can save image(png/jpg), Autocad script (scr) and print.

Sample image attached.

Have some fun.

I am attaching the programs here for download. And also program is available from sourceforge.

Program can be downloaded from

GeoFun

Epitrochoid image
index.php?t=getfile&id=4072&private=0


Warm Regards

Deepak

[Updated on: Fri, 01 March 2013 13:34]

Report message to a moderator

Re: GeoFun -- Plot Spirograph [message #39222 is a reply to message #39212] Fri, 01 March 2013 13:39 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
I am attaching the programs for download here.

Linux program -- after download set execute bit (file permissions) to run.

V0.26 available.

New features 'plot animation' and save as SVG file.

This is now new version with Animation of curve draw.


Warm Regards

Deepak

[Updated on: Wed, 13 March 2013 09:38]

Report message to a moderator

Re: GeoFun -- Plot Spirograph [message #39223 is a reply to message #39222] Fri, 01 March 2013 13:45 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
Attached windows exe.
This file is for win-64bit
  • Attachment: GeoFun-Win.7z
    (Size: 706.92KB, Downloaded 162 times)


Warm Regards

Deepak

[Updated on: Sun, 03 March 2013 18:58]

Report message to a moderator

Re: GeoFun -- Plot Spirograph [message #39242 is a reply to message #39223] Sun, 03 March 2013 18:59 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
Here is windows 32 bit file

This is a new file with Plot animation

V0.26 available.

New features 'plot animation' and save as SVG file.


Warm Regards

Deepak

[Updated on: Wed, 13 March 2013 09:39]

Report message to a moderator

Re: GeoFun -- Plot Spirograph [message #43720 is a reply to message #39242] Thu, 25 September 2014 19:47 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
Hi,

This is updated version of GeoFun.

Added Save to SVG.
and some minor UI enhancements.

Here is new code.

  • Attachment: GeoFun.7z
    (Size: 339.77KB, Downloaded 108 times)


Warm Regards

Deepak
Re: GeoFun -- Plot Spirograph [message #43722 is a reply to message #43720] Fri, 26 September 2014 09:01 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
Hello Deep

It is pretty. Would you like to upload it to Bazaar?.

You could have too a page where you could explain the package features. If you would have problems to do it I would help you.


Best regards
Iñaki
Re: GeoFun -- Plot Spirograph [message #43729 is a reply to message #43722] Sat, 27 September 2014 19:57 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
Hello Koldo,

Thank you for reviewing my code.

This package is now in "Examples".
I have updated the code.
I don't mind if it is in Bazaar.
Any place it is fine with me.


Warm Regards

Deepak
Re: GeoFun -- Plot Spirograph [message #43732 is a reply to message #43729] Mon, 29 September 2014 08:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
Hello Deepak

I cannot find it in Upp/Examples. Where could I find it?


Best regards
Iñaki
Re: GeoFun -- Plot Spirograph [message #43734 is a reply to message #43732] Mon, 29 September 2014 15:24 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
Hello Koldo,

GeoFun Example


Warm Regards

Deepak
Re: GeoFun -- Plot Spirograph [message #43740 is a reply to message #43734] Tue, 30 September 2014 17:23 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
True Rolling Eyes . Thank you.

Best regards
Iñaki
Re: GeoFun -- Plot Spirograph [message #43748 is a reply to message #39222] Wed, 01 October 2014 22:13 Go to previous messageGo to next message
ManfredHerr is currently offline  ManfredHerr
Messages: 67
Registered: February 2013
Location: Germany
Member
To set the execution flag on LINUX is not enough:
Shocked ./GeoFun: error while loading shared libraries: libgtk-x11-2.0.so.0
But the build from the sources in examples works well.
Re: GeoFun -- Plot Spirograph [message #43749 is a reply to message #43734] Wed, 01 October 2014 23:30 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 636
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello deep,

A small note on your code, you should never use following statement in your header file:
using namespace Upp;


This is definitly bad practice and it can lead to mistakes in the future.

You can improve your code quality by simply using:
// In header file (.h):
NAMESPACE_UPP

#define IMAGECLASS GFImg
#define IMAGEFILE <GeoFun/GeoFun.iml>
#include <Draw/iml_header.h>

// ...

END_UPP_NAMESPACE

// In implementation file (.cpp)
#include "GeoFun.h"

using namespace Upp;



Sincerely,
Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Wed, 01 October 2014 23:30]

Report message to a moderator

Re: GeoFun -- Plot Spirograph [message #43757 is a reply to message #43720] Fri, 03 October 2014 17:25 Go to previous messageGo to next message
ManfredHerr is currently offline  ManfredHerr
Messages: 67
Registered: February 2013
Location: Germany
Member
Hi Deepak,

on my UBUNTU 14.04 I tried your new export as SVG. Neither SVG-viewer of mine (Emacs, Firefox, etc.) did show a roulette curve but garbage.
A short examination of your code revealed that you try to export the points in float format rather than integer. Applying the following change
	
		for ( int j = 0; j < p.GetCount(); j++ )
//				sXML << Format ( "%0.4f", p[j].x ) << "," << Format ( "%0.4f",  p[j].y ) << " ";
				sXML << Format ( "%d,%d ", p[j].x, p[j].y );


produced a file that shows a part of the curve at least. It is one (4.) quadrant only because the shift of the origin is missing.

I hope this is of some help to you.

Manfred
Re: GeoFun -- Plot Spirograph [message #43771 is a reply to message #43757] Wed, 08 October 2014 17:01 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 197
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Manfred,

As per "SVG" specifications number is type float. Curves smoothness will be hampered if I change number to 'int' when image is scaled.

Thank you for your suggestions. Will check in Linux. If problem is there then will change the number format to 'int' for Linux compilation.

interface SVGNumber {
  attribute float value setraises(DOMException);
};

SVGNumber

InkScape opens the present saved image. Full image shown.

I checked in windows with Firefox, Chrome and IE all are showing the image. It is 1/4 ( positive quadrant). By default internet browsers expect SVG image with all positive values. My calculated path is in all 4 quadrants.

I have made required change to shift image to have all positive values in exported image. Full image is visible in Windows browsers.

Thanks for your suggestion Klugier
Quote:

A small note on your code, you should never use following statement in your header file:

using namespace Upp;

Made changes suggested by you. It includes origin shift also.
  • Attachment: GeoFun.7z
    (Size: 339.79KB, Downloaded 103 times)


Warm Regards

Deepak

[Updated on: Wed, 08 October 2014 17:02]

Report message to a moderator

Re: GeoFun -- Plot Spirograph [message #43772 is a reply to message #43771] Wed, 08 October 2014 18:42 Go to previous message
ManfredHerr is currently offline  ManfredHerr
Messages: 67
Registered: February 2013
Location: Germany
Member
Hi Deepak,

I think the problem in Linux is that your Format code produces floats with a comma rather than a point. So, the SVG interpreter sees four integers seperated by comma rather than two floats that are intended.
BTW, Point in UPP has integer coordinates as far as I know. To store them as floats or double does not increase the resolution.

Greets
Manfred
Edit:
The reason, why I generate floats with a comma rather than a point, is my LOCALE setting: it is GERMAN.
If I include
setlocale(LC_NUMERIC,"C"); // C-Standard
in GUI_APP_MAIN then I also produce a SVG file with floating point values that can be interpreted by SVG viewers.

[Updated on: Wed, 08 October 2014 22:05]

Report message to a moderator

Previous Topic: UppCad (or UltimateCad) is borning -- Updated January 2013 -- see last post
Next Topic: Alligator - Visual Studio PDB file analyzer
Goto Forum:
  


Current Time: Fri Nov 15 03:29:57 CET 2019

Total time taken to generate the page: 0.03950 seconds