ok...
so I'm trying work on a system that uses models composed of... basically the raw data you get from a curve...
(after multiplying the points together to get the equation)

I've been trying to visualize a concept for this method since I was in middle school (back in 2006),
and still can't wrap my mind around where to start...

so maybe some calculus nerds here could help me out... :/
)

So... no control points and using primitive objects... I'm still not sure exactly what you're getting at. Does constructive solid geometry come close to what you're trying to describe?

Aha... sounds more like dealing with parametric equations. Am I close? Like for the circle, you have: `x = r cos t` and `y = r sin t`, but you'd compose those with some mutation functions that modify the shape?

Just trying to visualize what that "triangle function" would actually …

Note: this is pseudocode, as I'm not familiar with python

Assuming deg = degree, r = radius

``````def square(deg,r)
newdeg = ((deg+45)%90-45)/180*Math.PI  # calculates the angle between the original angle and the closest axis
newr = r/Math.cos(newdeg)
return newr  # this is the radius for the given deg, in polar …``````

## All 16 Replies

these basically are a fix for NURBS :P
they don't use eveluators or control points...

they are the equations such as a radius from the center of a sphere with parameters that direct the drawing of that point...
)

So... no control points and using primitive objects... I'm still not sure exactly what you're getting at. Does constructive solid geometry come close to what you're trying to describe?

[Click Here](meh... close in the slightest... the equation isn't so much "constructive" as it is additive, but that does pose an interesting concept... we'll take things down to 2D for now and say, create an egg with an equation which would be a modified additive to subtractive radius for a curve starting at 270º (or -90º) and ending at 90º. in 3D, I've had the idea of calling it the "bubble" concept, where the character on-screen is literally nothing more than a bubble in space, with specific portions of the equation modified in a similar fascion to matrices (to morph the "bubble"'s protrusions and distortions). but for the problem at hand... curves are easy to deal with where a point covers a visual position in 2D space anywhere between 0.0 and 1.0...however, they use control points which pose a problem when it comes to 3D... (the evaluators must have the same numbr of control points for each layer of the sub-mesh)
)
[Click Here](I'm not going through entering new lines... screw that (screen scrolls when I use the arrow keys to move the cursor w/in the text)
)

I have an idea, though it didn't start to develope until I mentioned "additive"...

add a 2nd radius and you get either a sphere or an ellipse in 3D space...

by adding a triangular equation at specific radius points of the first and second radiuses, you can get a cube.
(note the 2nd radius os from 0º (bottom -90º) to 180º (top 90º), anything over will overdraw)
)

Aha... sounds more like dealing with parametric equations. Am I close? Like for the circle, you have: `x = r cos t` and `y = r sin t`, but you'd compose those with some mutation functions that modify the shape?

Just trying to visualize what that "triangle function" would actually be...

[Click Here](hmm... I think that would be the closest thing to describe this >.>

however, that "triangular function"...
I'm not sure how to write it down...
think of a point protruding from a sphere.

I can't test right now, but I know it can be done mathmatically.

I guess that's what I get for not getting anywhere over Advanced Algeebra in school :P)

a better description of that triangular function (for a 2D circle):
I'm not sure how to use math to write that...

NOTE: angle can be animated.
)

ok... so I'm no good at advanced math functions such as sin and cos and all that crap...
how would I get a square using a radius? (talking about 2D for now)

basically, the point to draw being a returned value from a function:

``````def square(degree,circle_rad=1.0):
return x,y #from origin 0,0
``````

where:
square(0) will return -1.0,0.0
square(45) will return -1.0,1.0
square(90) will return 0.0,1.0

NOTE: this is using the additive to subtractive method to the radius where the circle is inside the square.
calculating the square using the base radius as the corners of the square I assume would be a little more difficult to perform...

Note: this is pseudocode, as I'm not familiar with python

Assuming deg = degree, r = radius

``````def square(deg,r)
newdeg = ((deg+45)%90-45)/180*Math.PI  # calculates the angle between the original angle and the closest axis
newr = r/Math.cos(newdeg)
return newr  # this is the radius for the given deg, in polar form

# if you need cartesian coordinates instead, this converts polar to cartesian
x = newr*Math.cos(deg/180*Math.PI)
y = newr*Math.sin(deg/180*Math.PI)
return x,y
``````

This defines a square in which a circle of radius r is located.

I actually had a little bit wrong in my last example...
(0 degrees is the positive side of the X axis)

here's an example of what I have pictured:
0 degrees: (1.0, 0.0)
45 degrees: (1.0, -1.0)
90 degrees: (0.0, -1.0)
135 degrees: (-1.0, -1.0)
180 degrees: (-1.0, 0.0)
225 degrees: (-1.0, 1.0)
270 degrees: (0.0, 1.0)
315 degrees: (1.0, 1.0)

360 degrees: (1.0, 0.0)

also... I'm only good at eular coords on an ortho grid :(
I never went to school for this level of math...
so yea, I'm using horrible systems atm... -.-*

here's the test results I get for the radius:

0 degrees: 1.0
45 degrees: -1.0
90 degrees: 1.0
135 degrees: -1.0
180 degrees: 1.0
225 degrees: -1.0
270 degrees: 1.0
315 degrees: -1.0

I was expecting something along the lines of no negatives :/
since the radius should be additive to the corners from the center of the "circle" to make the square...

though you did mention it was polar >.>

Here's my output

``````Polar
0 degrees: 1
45 degrees: 1.41421356237309
90 degrees: 1
135 degrees: 1.41421356237309
180 degrees: 1
225 degrees: 1.41421356237309
270 degrees: 1
315 degrees: 1.41421356237309

Cartesian
0 degrees: 1, 0
45 degrees: 1, 1
90 degrees: 0, 1
135 degrees: -1, 1
180 degrees: -1, 0
225 degrees: -1, -1
270 degrees: 0, -1
315 degrees: 1, -1
``````

Angles increase by going counter clockwise.

I probably should've noted I'm using Python2.7.5
(I don't like 3x so please don't suggest)

here's what I get for the Cartesian coord:
0 degrees: (1.0, 0.0)
45 degrees: (-1.0, -0.0)
90 degrees: (1.0, 0.0)
135 degrees: (-1.0, -0.0)
180 degrees: (-1.0, 1.2246467991473532e-16)
225 degrees: (1.0, -1.2246467991473532e-16)
270 degrees: (-1.0, 1.2246467991473532e-16)
315 degrees: (1.0, -1.2246467991473532e-16)

my function:

``````def square(deg,r=1.0):
newdeg = ((deg+45)%90-45)/180*pi
newr = r/cos(newdeg)
#return newr  # this is the radius for the given deg, in polar form
x = newr*cos(deg/180*pi)
y = newr*sin(deg/180*pi)
return x,y
``````

also... thanx for telling me the rotation direction. :)
I was unsure about that. :P

also...
I'm thinking about getting rid of the int degree input and making it more of a percentage float input.
that way thingss will be more accurate for the 3D radius.
(the second 2D curve that follows from the first)

sphere(0.0,1.0, 1.0,1.0) >>> 0.0, 1.0, 0.0 (the top of the sphere at the Y axis)
sphere(0.25,0.0, 1.0,1.0) >>> 0.0, 0.0, 1.0 (the back of the sphere at the Z axis)

sphere(0.0,-1.0, 1.0,1.0) >>> 0.0, -1.0, 0.0 (the bottom of the sphere at the -Y axis)

ranges in degrees:
sphere(
0.0 : 0; 1.0 : 360,
0.0 : 0; 1.0 : 90; -1.0 : -90,

OMG I hate this text editor >_<
it's like the chinese, where they move their mouth and then you hear the words :P

how would one go about building a GL viewer that could use the Bresenham method to display a circle as a slew of verts??
(applying the verts as pixels)

also,
could it be possible to make the equation for the circle singular??
(as in var = equation, then use the parser to derrive x,y from the var)
^ probably not possible for the dual-radius (3D) method.

basically, what I'm looking for is X,Z will be the axis for the first radius.
then @(X,Z),Y will be the axis of the second radius to make the sphere/ellipse.

modifications to either axis will redefine the shape at particular points/angles.

wait... now thinking of that, we only need the primary radius...
the only affection is the secondary degree which can be used to modify the radius at the secondary axis.
/derp

do you guys see what I'm talking about??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.