[Analytic Geometry] [Request] Script for creating parametric lines and planes

Hi there!

I know that there are very clever people in this forum.
Now I’m looking for a possibility to create parametric lines and planes with python. It’d be a great feature, to have sliders for parameters. To conclude, I’d like to use blender as a 3D Function plotter - not with equations like used in the addon “3D Function Surfaces”, but like in school, based on vectors.

It should work like this:
You have an equation for a line, for example:

VectorSa = (1 | 2 | -1) + m*(2 | -2-a | 1 + a)

So you get concurrent lines as the result.

My python knowledge is very basic, but I’m ready to learn the necessary commands. So, it’d be great if you could provide me some ressources, or even a code snippet (don’t want to ask for too much).

what about dissecting: http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Add_Mesh/Add_3d_Function_Surface
you’d like a box to type in

VectorSa = (1 | 2 | -1) + m*(2 | -2-a | 1 + a)

?
interesting…

this is not a parametric line equation
you need to use like a bezier parametric line
and this has alrady been done berofe
hum but go to find in which thread

are you talkng about a quad coplanar face here?

but don’t remember how to make a parametric face
i’v seen a bezier patch but that’s not a quad coplanar face!

happy 2.5

Thank you for your quick answers.

I have to explain it a bit more. My first posting was written while I was sitting in my math lesson and I was in a hurry. I’d just like to apply the math knowledge in a sort of a blender addon or feature.

But first of all to the answers:

Well, that’s kind of the way I want to go. But I recently did a videotutorial on the 3D function surfaces, so I know, that this is not the desired effect, since it doesn’t work with vectors, but with implicit and explicit equations. In other words, I want to have full control over my model like in this addon with textfields and slide controls, yes. But I want to input other formated information. My main intention is to create a feature for educational purpose, to teach students how vectors and 3D math works - what would be better than a highly-sophisticated 3D Software?! :slight_smile:

That’d be nice, but I think that’s too complicated for my intention. Since there are only lines and planes to be shown, curves are not really needed. And if yes, they should be created with vector-based methods.

Exactly this is what I’m talking about :slight_smile: Normally there is a problem with planes - they go on into infinity. So I need a way to “cut” them off at certain limitations. I thought about a slider control to set the interval of all the possible values for the parameters respectively.

So let’s start from the beginning.
Example 1: Parametric line equation

These start with a vector that represents the origin. So if the origin vector is e.g. (2|3|-5), then we “walk” 2 units in x-direction, 3 units in y-direction and -5 units in z-direction, measured from the coordinate space origin. This is part one of our equation.
Part two says, where the line should expand, namely in what direction. So we need a second vector. This is generelly a parameter (e.g. μ) multiplied by a vector, e.g. (-3|2|2). Since μ can be every possible number, we can set points all along from our origin point in our defined direction and (with negative values) even in the opposite direction. But that’s also our problem (the line would go into infinity - this could cause problems in rendering), which can be solved by defining a limitation for μ.
I did some image manipulation on how slide controls could look like:

http://blender.lwtv.de/features/Vector_input.jpg http://blender.lwtv.de/features/Limitation.jpg

Of course, changes of the values should be dynamic and in realtime!

Example 2: Parametric plane equation
This should work just like the line settings, but with two directional vectors, instead of one(with the scaling parameters e.g. λ and μ). So eventually the plane is described by three vectors:

  1. a vector that says where the origin of the plane is
  2. the first directional vector
  3. and the second directional vector which span the plane.

And that concludes the technical part. Hopefully my english is not so bad, that you don’t understand anything - if so, then just tell me! I’ll try to explain it more clearly.

Addition: Parameters in vector coordinates

Something I ain’t clear myself about is the use of more parameters. For example for the coordinate values. So, like a vector in this manner (1-a|a+5|a). This would mean, that there should appear a new slidecontrol for every new parameter or there could be a fixed number of parameters in the beginning. I think, the effect it would have, would be pretty impressive!

Summary:

Simply I need a script that is able to update the mesh dynamically. The user should be able to set his points and vectors with text input fields as well as slide controls. The logic in python would then calculate the position of points with simple analytic geometry methods. Hopefully it is easy to display points more visible in the 3D view, by creating spheres or textfields at the resultant coordinates or even display the vector with an actual vector mesh (but that’s just for visualizing). Extensions then could be to calculate intersections between planes and lines, but that should be easily possible when I know how to write the code for the original problem, since this is only a bit more math.

Hmm, this shouldn’t be no rocket science, should it?! :-/
What do you think? How would you rate my idea for this project(I can cope with critics)?

Thank you all for contributing ideas!

look at wiki 2.5 script
there is already a mathutil representation for vectors

might give some ideas may be to begin with

happy 2.5

Hi RickyBlender,

thank you for your advice. :slight_smile:

I know about that Mathutils Module already. It’s really great, that everything is provided, like e.g. the cross-product, the dot-product and every other major mathematical operation.

The bad thing, though, is that I don’t really know how to display the calculated values. This means, how I do set points, connect them to lines or even form polygons with python(for the planes). How do I prevent errors in displaying the geometric figures and so on and so forth.
Setting Variables in the python code shouldn’t be a problem at all. But manipulating them with slider controls and updating the output in the 3D window in realtime is.

My problem is just the misunderstanding of the main, crucial areas in programming such a tool.

Hopefully I can soon start with the programming(unfortunately school is taking up most of my time). If meet any errors on my way, I will of course post them here.
If anyone has some more suggestions, I’m looking forward to them! :slight_smile:

Thanks!

well making a plane is very easy

and probably possible to have this done in the draw method so it updates in real time in viewport

so begin your script and you can ask questions here as you go along!

if you have the link to download script for mathutil cause i cannot find it
let me know!

happy 2.5

Instead of leaving everything as parametric objects, what about being able to click on lines and using them as the input? (after clicking an = symbol first). Somehow keeping track of all the extrusions/other parametric things that were used to create the object. This could function sorta as modifiers, where you leave the base shape plane and then revolve/extrude/bevel/etc it later, but also being able to see what everything is.

Basically i mean making blender closer ot autodesk inventor, as i feel that is a very easy way of creating “hard” objects.

@BlenderEi
too long …
pm to you

Hi there, great news!

orinoco56 took his time and developed this tool. Until now, it’s for lines only, though. Nevertheless he did a great job and I don’t want to hide the result from you :slight_smile:

Here you have a screenshot:


and here’s the script:
http://lwtv.de/bos/ParametricLine.zip

Just install the addon (it will be available under the “add mesh” category) and look in your 3d view properties. There will be some parameters you can change in realtime, exactly how I wanted. A big thank you goes to him for developing this function!

I just took a look into the wiki for the module. There is also a script for doing calculations on vectors, but I don’t know what script you mean. This is the page I looked at: http://www.blender.org/documentation/250PythonDoc/mathutils.html

Hmm, I think I don’t really got your point. Extrusion and Beveling isn’t necessary at all. And clicking on the lines doesn’t make sense, since the line needs to be created from a parametric input field.

Yes, this is definitely something blender needs. I also think, that making the creation of new objects more dynamically would improve it a whole lot. But the downside to that is, that blender would need a complete rewrite of the internal engine to achieve this. On the whole, it is possible to get used to blenders approach with objects.
I don’t know Autodesk Inventor personally, but as far as I read through wikipedia it is nothing that couldn’t be achieved with blender :slight_smile: It just needs talented artists.

All in All, I can call this thread quits. I like the result of my posting and everyone should have the opportunity to use orinoco56’s addon now to learn more about vectors and their relation to lines in 3D.

Thank you all and have a nice weekend!