My assumption is that the lattice modifier uses the edges of the mesh to make the lattice. I'm wondering if there's a way to give the modifier a list of lines(all connected) and derive a lattice structure from them. My aim is to build a structure in wire-frame, make a lattice, smooth it and export it as an STL file. Any ideas?
I'm using processing 1.5 in Win XP and I've started to get some strange errors:
The type toxi.geom.Mesh3D cannot be resolved. It is indirectly referenced from required.class files
I know there's nothing wrong with the sketch, it's direct from Toxi (posted here) and I'm using the latest library (0020)
any ideas what I might be doing wrong?
PixelBender is a great implementation for Adobe products, I'm wondering if anyone has made a translater to use it with processing. I think that would be awesome. I know Processing can do anything PB can do, but being able to make and use plugins would be great
void setup() {
// define a rounded cube using the SuperEllipsoid surface function
SurfaceFunction functor=new SuperEllipsoid(0.3,0.3);
SurfaceMeshBuilder b = new SurfaceMeshBuilder(functor);
// execute the mesh (resolution=80, radius=100)
TriangleMesh mesh = (TriangleMesh)b.createMesh(null, 80, 100);
// attempt to create a FileOutputStream and save to it
try {
String fileID="superellipsoid-"+(System.currentTimeMillis()/1000);
FileOutputStream fs;
fs=new FileOutputStream(sketchPath(fileID+".stl"));
mesh.saveAsSTL(fs);
fs=new FileOutputStream(sketchPath(fileID+".obj"));
mesh.saveAsOBJ(fs);
}
catch(Exception e) {
e.printStackTrace();
}
exit();
}
which gives me a FileOutputStream. How would I convert the FileOutputStream into a byte array so that I can save it to my server? Or, is there a better way?
I'm wondering if there's a library for Processing that will help me efficiently triangulate the area inside a blob. I want to detect a blob( there are libraries for that) and then create a triangle network that will keep the curve of the blob outline smooth. I hope I'm being clear enough.
Using the controlP5 library, I'm having trouble. The sliders work alone, as do the radio buttons; But I can't get them to play together: I get this error message....
Jan 19, 2011 11:34:34 PM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller value
to a method in your program. Please check your code for any
possible errors that might occur in this method .
e.g. check for casting errors, possible nullpointers, array overflows ... .
method: controlEvent
exception: java.lang.reflect.InvocationTargetException
I'm working on a sketch that requires P3D, I need a menu but fonts do badly in P3D. I'd like to put my controlP5 components in an offscreen buffer and draw the buffer to the main sketch but I can't figure out how this might be accomplished. Any ideas?
I'm working on a sketch in which I must compare a series of points against a series of line segments and determine if the points lie within x distance of the lines, or not. I'm having trouble with the math. I'm guessing that many of you have solved this efficiently, any help is greatly appreciated.
I'm still fairly new at processing and even newer at 3D object creation. I've successfully created a 3d mesh in processing. I now want to apply some modifiers using the HEMESH library. The library uses HEMESH objects and has a method to create these objects from ordinary meshes. The javadocs say that HEC_FromSimpleMesh Creates a new mesh from a list of vertices and faces. Here is the method:
public HEC_FromSimpleMesh setSource(wblut.geom.WB_SimpleMesh simpleMesh)
Set simpleMesh source
Parameters:
simpleMesh - source
Returns:
self
My problem is that I don't know what format to use in setSource. Should I use a mesh object, a 2d array, 2 arrays....I just don't know.
Using 1.2.1 on a pc with XP I'm trying to run the included PDF sketches in the examples folder and get these error messages:
You need to use "Import Library" to add processing.pdf.PGraphicsPDF to your sketch.
cannot find a class or type named :PGraphicsPDF"
Is this a problem with my installation or something else? Anyone else having this problem?
I'm hoping someone has already done the math on this one. I know that it can't be solved perfectly, but close would be nice. Suppose I have a sphere, it's covered in square pixels. At the equater there might be 360, at the pole 3. Now I want to address each pixel in a 2-dimensional array so that I can calculate a reaction-diffusion equation on the surface of a sphere. This equation requires consulting adjoining pixels. Can anyone give me a place to start, my math is very weak.
I found this notation in someone's code and I don't understand it:
ref[i]=(random(2)<1);
I understand that random(2) returns a value between 0 and 2, but what is the "<1" for?
GL gl;
PGraphicsOpenGL pgl;
PGraphics mySave;
float fMag = .05;
float K = .2;
float D = 1.5;
float rest = .3;
float tick = .1;
float scaler = 5;
int controlHeight = 500;
int controlWidth = 200;
//data structures
ParticleSystem pSys = new ParticleSystem(0,.25);
Spring[] springs = new Spring[0];
ArrayList forces = new ArrayList();
MyParticle[] particles = new MyParticle[0];
Spring[] springs2 = new Spring[0];
MyParticle[] particles2 = new MyParticle[0];
ControlP5 cp5;
ControlGroup menu;
//all have to be even
int x_divs = 22;//14 //30 radial divisions on inside and outside
int y_divs = 8; // 6 vertical divisions outside
int y_divs2 = 10; //vertical divisions inside
MyParticle grid[][];
MyParticle grid2[][];
Face faces[] = new Face[0];
Face faces2[] = new Face[0];
ArrayList shape_outline = new ArrayList();
PGraphics3D pg;
//initial ring shape in mm
//small 35.2
//medium 35.65
//large 38.32
float rad = 38.32;//10 //18
float prad = rad;
float minZ = -15;
float maxZ = 15; // 30 35
float pmaxZ = maxZ;
In using Traer physics, I want to add two integer values to class particle and be able to access them but I don't know how; can someone help me.
Here is the source: particle.java
public Particle( float m )
{
position = new Vector3D();
velocity = new Vector3D();
force = new Vector3D();
mass = m;
fixed = false;
age = 0;
dead = false;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#distanceTo(traer.physics.Particle)
*/
public final float distanceTo( Particle p )
{
return this.position().distanceTo( p.position() );
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#makeFixed()
*/
public final void makeFixed()
{
fixed = true;
velocity.clear();
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#isFixed()
*/
public final boolean isFixed()
{
return fixed;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#isFree()
*/
public final boolean isFree()
{
return !fixed;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#makeFree()
*/
public final void makeFree()
{
fixed = false;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#position()
*/
public final Vector3D position()
{
return position;
}
public final Vector3D velocity()
{
return velocity;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#mass()
*/
public final float mass()
{
return mass;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#setMass(float)
*/
public final void setMass( float m )
{
mass = m;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#force()
*/
public final Vector3D force()
{
return force;
}
/* (non-Javadoc)
* @see traer.physics.AbstractParticle#age()
*/
public final float age()
{
return age;
}
protected void reset()
{
age = 0;
dead = false;
position.clear();
velocity.clear();
force.clear();
mass = 1f;
}
}
my math visualization skills are shaky, I'm hoping someone can help me out.
the problem: I have have a 3D shape I've built on the x-y plane and I have a truncated cone whose axis is z. I want to wrap the 3D object around the cone.
I assume that I'll want to normalize the u-v of both the object and the cone. Then convert the object vertex and face coordinates to u-v-w vectors. Then, I'll want to copy those vertexes and faces in relation to the cone surface, allowing for the spread resulting from the curved surface and render them in world coordinates. Is that about right?
Can someone help me with the math? Especially allowing for the spread due to the curve.
I've been trying to use spline3D and have been having a hard time. I found an example by Toxi, so it SHOULD work, but I get an error in processing 1.2.
the code is here:
http://processing.org/discourse/yabb2/YaBB.pl?num=1229440845/2#2 and the error is:
cannot convert from List<Vec3D> to ArrayList.
Any Idea what changed and how I can fix it?
OK, I have a question and I'm not sure I can even ask it properly. I'm pretty new at processing and deficient in 3D math. Imagine I had line emanating from 0,0,0 and then a spiral from the end...that's not hard. Now, imagine I had a series of these, lets say 12 so that each passed through the center of a face of a dodecahedron. I don't know, to what or how to orient the vectors so that the spirals will be uniform; that is, so they will intersect a corner of each's pentagon uniformly. Does the question make sense to anyone? Can anyone help?
I'm using the PDF to Bytes code discussed here: PDF to bytes();
http://processing.org/discourse/yabb2/YaBB.pl?num=1237962559 I'm actually using the original source...without changes, on Processing 1.2.1, also tried on 1.1. I'm getting an error:
Cannot cast from PGraphics to inMemoryPGraphicsPDF.
The code was developed in an older version. What changed and how can I change the code to work in the newer versions?
I'm using the supplied example DropFilesAndFolders.pde
the way I'm reading it, myFile should be an array with the names of the files in the directory I dropped onto the sketch but I can't access it as an array; myFile.length() returns 0.0.;
I'd like an array of the filenames so that I can work with the files. Any ideas?
/**
* DropFilesAndFolders demonstrates how to access the information of
* a file or folder that has been dragged into the sketch.
* code by andreas schlegel.
http://www.sojamo.de/libraries/drop */
import sojamo.drop.*;
SDrop drop;
void setup() {
size(400,400);
drop = new SDrop(this);
}
void draw() {
background(0);
}
void dropEvent(DropEvent theDropEvent) {
if(theDropEvent.isFile()) {
// for further information see
//
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html File myFile = theDropEvent.file();
println("\nisDirectory ? "+myFile.isDirectory()+" / isFile ? "+myFile.isFile());
if(myFile.isDirectory()) {
println("listing the directory");
// list the directory, not recursive, with the File api. returns File[].
println("\n\n### listFiles #############################\n");
println(myFile.listFiles());
// list the directory recursively with listFilesAsArray. returns File[]
println("\n\n### listFilesAsArray recursive #############################\n");
println(theDropEvent.listFilesAsArray(myFile,true));
// list the directory and control the depth of the search. returns File[]
println("\n\n### listFilesAsArray depth #############################\n");
println(theDropEvent.listFilesAsArray(myFile,2));
}
}
}
I've run into this several times trying to use and understand other people's code. Since the code was posted, I assume it used to work, but won't now. What does this mean and how can I fix it?
/**
* a very light wrapper around a PImage that tracks the mouse
*/
class MouseImage {
PImage img;
MouseImage(String filename) {
img = loadImage(filename);
}
void draw() {
translate(mouseX-img.width/2f, mouseY-img.height/2f, 0.1f);
image(img, 0, 0);
}
}
I'm still very new at processing, but I've been learning from you all.
what I want to do is import an object into volumetric space. I then want to create an array corresponding to that volumetric space; setting each array element to either 1 or 0, depending on whether the model is present at that point in volumetric space. I don't know how to test whether a point is inside a model. Help would be appreciated.
I'm still new to Processing, but I'm learning from people at the forum.
I've written a sketch and With Toxi's help, it now creates an STL. I'd like to make it an applet and save the STL to my server, is that possible? You've helped me learn to save image files, I can do that, but a data(STL) how can we do that?