Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
sajid.saiyed
sajid.saiyed's Profile
4
Posts
3
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Tapering Spiral
[4 Replies]
30-Sep-2013 03:12 AM
Forum:
Programming Questions
Hi,
Can someone help me with this?
I am trying to create a tapering spiral.
The eventual goal is to make something like this:
http://3.bp.blogspot.com/-5rUq8XHjBWM/Ucc8uxPqVoI/AAAAAAAAMpc/Y2xEpXeDxps/s1600/Image1.png
So the first challenge I need to solve is to get a smooth tapering spiral.
I have got something like this. But the problem is, since I am using ellipse, the dots become visible at the end of the tail.
Is it possible to create something like this with bezier tool?
This is what I have right now:
float r = 0;
float theta = 0;
float eStart = 8;
void setup() {
size(600,600);
background(255);
smooth();
}
void draw() {
spiral();
noLoop();
}
void spiral(){
for(int i=0; i<400; i++){
float x = r*cos(theta);
float y = r*sin(theta);
noStroke();
fill(0);
ellipse(x+width/2, y+height/2, eStart, eStart);
eStart -=0.02;
theta += 0.01;
r += 0.5;
}
}
Help with TileExporter by Karsten Schmidt / Marius Watz
[0 Replies]
22-Jul-2013 10:48 AM
Forum:
General Discussion
Hi,
I was once again trying to figure out how to export high resolution images form processing.
I noticed on Marius Watz website that he refer to TileExporter code by
Karsten Schmidt.
But when I follow the link, it goes to old processing forum and is a dead link.
After wondering for a while, I came across the "
DecodeIdent
" project.
I can see the tiler code here, but the whole source code is so complex that I am unable to find instructions on how to use the TileExporter.
Has anybody had experience with this and can share some insights on how to use this code?
Your help is appreciated.
Thanks
Need help with Toxi Tiler code
[0 Replies]
26-Jan-2011 08:05 AM
Forum:
Contributed Library Questions
Hi everyone,
I was trying to use the Toxi Tiler code to see if I can save large images from dynamically moving sketches.
To do a quick try, I adopted a sketch from Alessandro Capozzo - GHOSTAGENCY.
I added a keypress code to pause the sketch first before saving the image.
Here is the code:
// built with processing 0.67/0.68
// by Alessandro Capozzo - GHOSTAGENCY -
// winter 03-04
// Adopted to Processing 1.2.1 by Sajid Saiyed (www.ssdesigninteractive.com/g2)
import processing.opengl.*;
import toxi.geom.*;
boolean go = true;
float noiseScale=0.012f;
float gg=1;
int limit;
/////////
Tiler tiler;
// camera field of vision and desired clipping planes
float FOV=radians(90);
float CLIP_NEAR=1;
float CLIP_FAR=5000;
int NUM_TILES=3;
/////////
void setup(){
size(600,200,OPENGL);
frameRate(30);
limit=width+180;
tiler=new Tiler((PGraphics3D)g,NUM_TILES);
}
void draw() {
graph();
}
void graph() {
// Check whether to play the sketch or Pause.
if(go == true)
{
background(220);
noFill();
gg+=1;
for(int x=0; x<(limit); x++) {
float noiseVal = noise((gg+x)*noiseScale,.3f*noiseScale);
int c=color(noiseVal*255,noiseVal*230,noiseVal*210,20);
stroke(c);
beginShape();
vertex(x, height*noiseVal);
bezierVertex(.8f*x+noiseVal, 200+noiseVal*1.2f, .6f*x-noiseVal, 200+noiseVal*1.4f, x,height*noiseVal);
//bezierVertex(.6f*x-noiseVal, 200+noiseVal*1.4f);
//bezierVertex(x,height*noiseVal);
endShape();
int d=color(noiseVal*220,noiseVal*230,noiseVal*210,20);
stroke(d);
beginShape();
vertex(x,height*noiseVal);
bezierVertex(.8f*x-noiseVal, noiseVal*1.2f, .9f*x+noiseVal, noiseVal*1.4f, x,height*noiseVal);
//bezierVertex(.9f*x+noiseVal, noiseVal*1.4f);
//bezierVertex(x,height*noiseVal);
endShape();
}
}
else
{
tiler.pre();
tiler.post();
}
}
int value;
void keyPressed() {
println(keyCode);
value = keyCode;
// Press "s" to stop the sketch.
// after that Press "a" to save the tiler image.
// then pres any other alphabet key to resume sketch
if (value == 83) {
go = false;
}
else if (value == 65)
{
saveMe();
}
else {
go = true;
}
}
void saveMe() {
tiler.initTiles(FOV,CLIP_NEAR,CLIP_FAR);
tiler.save(sketchPath("export"), "tiles-" + (System.currentTimeMillis() / 1000), "tga");
}
/**
* Implements a screen tile exporter with support for FOV,
* clip planes and flexible file formats.
*
* Re-engineered from an older version by Marius Watz:
*
http://workshop.evolutionzone.com/unlekkerlib/
*
* @author toxi <info at postspectacular dot com>
*/
class Tiler {
protected PGraphics3D gfx;
protected PImage buffer;
protected Vec2D[] tileOffsets;
protected double top;
protected double bottom;
protected double left;
protected double right;
protected Vec2D tileSize;
protected int numTiles;
protected int tileID;
protected float subTileID;
protected boolean isTiling;
protected String fileName;
protected String format;
protected double cameraFOV;
protected double cameraFar;
protected double cameraNear;
public Tiler(PGraphics3D g, int n) {
gfx = g;
numTiles = n;
}
public void chooseTile(int id) {
Vec2D o = tileOffsets[id];
gfx.frustum(o.x, o.x + tileSize.x, o.y, o.y + tileSize.y,
(float) cameraNear, (float) cameraFar);
}
public void initTiles(float fov, float near, float far) {
tileOffsets = new Vec2D[numTiles * numTiles];
double aspect = (double) gfx.width / gfx.height;
cameraFOV = fov;
cameraNear = near;
cameraFar = far;
top = Math.tan(cameraFOV * 0.5) * cameraNear;
bottom = -top;
left = aspect * bottom;
right = aspect * top;
int idx = 0;
tileSize = new Vec2D((float) (2 * right / numTiles), (float) (2 * top / numTiles));
double y = top - tileSize.y;
while (idx < tileOffsets.length) {
double x = left;
for (int xi = 0; xi < numTiles; xi++) {
tileOffsets[idx++] = new Vec2D((float) x, (float) y);
x += tileSize.x;
}
y -= tileSize.y;
}
}
public void post() {
if (isTiling) {
subTileID += 0.5;
if (subTileID > 1) {
int x = tileID % numTiles;
int y = tileID / numTiles;
gfx.loadPixels();
buffer.set(x * gfx.width, y * gfx.height, gfx);
if (tileID == tileOffsets.length - 1) {
buffer.save(fileName + "_" + buffer.width + "x"
+ buffer.height + "." + format);
buffer = null;
}
subTileID = 0;
isTiling = (++tileID < tileOffsets.length);
}
}
}
public void pre() {
if (isTiling) {
chooseTile(tileID);
}
}
public void save(String path, String baseName, String format) {
(new File(path)).mkdirs();
this.fileName = path + "/" + baseName;
this.format = format;
buffer = new PImage(gfx.width * numTiles, gfx.height * numTiles);
tileID = 0;
subTileID = 0;
isTiling = true;
}
public boolean isTiling() {
return isTiling;
}
}
Now when I run this code, the image that is getting saved is a large tile of 9 identical images instead of one big image.
I am sure I am doing something wrong here :(
Would really appreciate some help as I am planning to write a dynamic sketch like this one and would want to print it large size.
Thanks
How can I pause an OPENGL sketch to use Toxi's Tiler
[5 Replies]
15-Nov-2010 09:27 PM
Forum:
Contributed Library Questions
Hi,
I have a looping OPENGL sketch.
Now I wanted to use Toxi's Tiler class to export large size image.
I read in other forums that the Tiler works best with Static sketches and the best way to export a looping sketch would be to "Pause" it.
I am not sure how can I "Pause" my sketch?
If I use noLoop() then even the Tiler code does not work :(
Any suggestions?
TIA
«Prev
Next »
Moderate user : sajid.saiyed
Forum