Hmm...

I notice that load'graph' no longer provides the steps verb mentioned
in http://www.jsoftware.com/books/pdf/expmath.pdf

So here's a workalike:
   steps=: 3 : 'a+(w)*(i.n+1)%n[w=.z-a[''a z n''=.y'

and that gives us an example of a surface plot.

Next, we need a parametric representation of the ellipse, and
http://en.wikipedia.org/wiki/Ellipsoid#Parameterization looks like a
plausible approach there.

Using that, and http://www.jsoftware.com/help/jforc/graphics.htm as a
starting point, it seems to me that I ought to be able to draw an
ellipse like this:

a=:3[b=:4[c=:5

X=:4 :0~
  a*(cos x)*/cos y
)

Y=:4 :0~
  b*(cos x)*/sin y
)

Z=:4 :0~
  c*(sin x)*/1: y
)

draw=:3 :0
  angles=: steps _1p1 1p1 100
  x=. X angles
  y=. Y angles
  z=. Z angles
  'surface' plot x;y;z
)

draw''

Sadly, that's not an ellipse.

But I do not have enough familiarity with plot to know whether I've
screwed up my math or if there's a defect in plot -- I don't know how
to isolate the problem.

That said, a quick test with a 3d model of a cube:

   'surface' plot ;/|:#:i.8
|NaN error: ncile

...suggests that plot isn't really designed to represent 3d solids.

Still, that does not eliminate any potential errors on my part.

On the other hand, maybe the right approach would be to use jhs and
generate a distance field renderer along the lines of what you see at
shadertoy.com.

I'll have to think a bit to see if I can pull off something like that.
(I think that that would only work for people who have adequate
graphics hardware support. But I think you have a suitable graphics
card?)

Thanks,

-- 
Raul


On Fri, Mar 6, 2015 at 7:10 PM, Skip Cave <s...@caveconsulting.com> wrote:
> I want to plot a 3D ellipse (ellipsoid) and then be able to change the
> lengths of the three axes. The equation of an ellipse with axis lengths of
> a, b, & c is:
>
>  ((x^2)%(a^2)) + ((y^2)%(b^2)) + ((z^2)%(c^2)) = 1
>
> How can I arrange this so it can be plotted in a 3-D plot in J, and then be
> able to  experiment with the lengths of the axes?
>
> Skip
>
> Skip Cave
> Cave Consulting LLC
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to