|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In the past I always "differenced" objects, never a plane, and maybe that's why
I never noticed this before. Say I want a sphere with the top cut off:
difference {
sphere { 0 1 }
plane { y 0.8 }
texture { T_Brass_1D }
}
Not what I want; only the top segment is kept. Logic holds that
plane { -y -0.8 }
should do the trick, cutting away the stuff above the (inversed) plane instead
of below it. But POV-Ray doesn't seem to accept negative distances here!
How do I do this?
TIA
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
stevenvh napsal(a):
> In the past I always "differenced" objects, never a plane, and maybe that's why
> I never noticed this before. Say I want a sphere with the top cut off:
>
> difference {
> sphere { 0 1 }
> plane { y 0.8 }
> texture { T_Brass_1D }
> }
>
> Not what I want; only the top segment is kept. Logic holds that
>
> plane { -y -0.8 }
>
> should do the trick, cutting away the stuff above the (inversed) plane instead
> of below it. But POV-Ray doesn't seem to accept negative distances here!
> How do I do this?
> TIA
>
>
It does support negative distances here. What happens here is that it
understands -y-0.8 as a single expression. You should type
plane{-y,-0.8} instead.
--
You know you've been raytracing too long when...
you ever saw a beautiful scenery and regretted not to take your 6"
reflective ball and a digital camera, thinking "this would have been a
perfect light probe"
-Johnny D
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
stevenvh <nomail@nomail> wrote:
> plane { -y -0.8 }
-y -0.8 = <0, -1, 0> - <0.8, 0.8, 0.8> = <-0.8, -1.8, -0.8>
Expressions are evaluated first, after that the optional commas.
In this case the comma is not all that optional because without it
the expression takes precedence.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp <war### [at] tagpovrayorg> wrote:
> stevenvh <nomail@nomail> wrote:
> > plane { -y -0.8 }
>
> -y -0.8 = <0, -1, 0> - <0.8, 0.8, 0.8> = <-0.8, -1.8, -0.8>
>
> Expressions are evaluated first, after that the optional commas.
> In this case the comma is not all that optional because without it
> the expression takes precedence.
>
> --
> - Warp
Thanks Warp & Jan.
My problem is with the "optional". I'm used to work with programming languages,
and parameter separators are mandatory in every language I know. I wish they
were in POV-Ray too.
(You may argument that I'm free to write the commas, but you know how it goes:
you learn POV-Ray by reading existing code...)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
stevenvh <nomail@nomail> wrote:
> I'm used to work with programming languages,
> and parameter separators are mandatory in every language I know. I wish they
> were in POV-Ray too.
The problem with that would be that if they were mandatory you wouldn't
be able to do things like this:
#declare Spline =
spline
{ cubic_spline
#declare Ind = 0;
#while(Ind < Amount)
Ind/(Amount-1), Point[Ind]
#declare Ind = Ind+1;
#end
};
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> The problem with that would be that if they were mandatory you wouldn't
> be able to do things like this:
A common solution is to allow an extra comma at the end of lists, so you
could do:
> #declare Spline =
> spline
> { cubic_spline
> #declare Ind = 0;
> #while(Ind < Amount)
> Ind/(Amount-1), Point[Ind],
> #declare Ind = Ind+1;
> #end
> };
I know C allows this in some cases and it's very convenient. (Maybe POV-Ray
does too, but my point is that it works well when commas are required, which
is good for avoiding problems like steven's.)
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
stevenvh wrote:
> In the past I always "differenced" objects, never a plane, and maybe that's why
> I never noticed this before. Say I want a sphere with the top cut off:
>
> difference {
> sphere { 0 1 }
> plane { y 0.8 }
> texture { T_Brass_1D }
> }
>
> Not what I want; only the top segment is kept. Logic holds that
>
> plane { -y -0.8 }
>
> should do the trick, cutting away the stuff above the (inversed) plane instead
> of below it. But POV-Ray doesn't seem to accept negative distances here!
> How do I do this?
> TIA
>
The key here is that, for CSG, the "inside" of a plane is the side
_opposite_ the normal. Also, the second parameter in the plane is the
distance from the origin _in the direction of_ the normal. (Plus, as
others here have pointed out, be sure to use the commas in these
expressions.) IOW:
difference {
sphere { 0, 1 }
plane { y, 0.8 }
texture { Whatever }
}
gives you the top "cap" of the sphere, and plane { -y, 0.8 } gives the
same "cap" but from the bottom of the sphere. What you're looking for
is plane { -y, -0.8 }. See the attached illustration.
Hope this clarifies things. :-)
-=- Larry -=-
Post a reply to this message
Attachments:
Download 'diff.png' (19 KB)
Preview of image 'diff.png'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
en ce 2008/04/12 13:31 :) ->
> In the past I always "differenced" objects, never a plane, and maybe that's why
> I never noticed this before. Say I want a sphere with the top cut off:
>
> difference {
> sphere { 0 1 }
> plane { y 0.8 }
> texture { T_Brass_1D }
> }
>
> Not what I want; only the top segment is kept. Logic holds that
>
> plane { -y -0.8 }
>
> should do the trick, cutting away the stuff above the (inversed) plane instead
> of below it. But POV-Ray doesn't seem to accept negative distances here!
> How do I do this?
> TIA
>
>
While all the others is correct, in your case you can replace "difference" by
"intersection". That way, instead of keeping what NOT in the plane, you keep the
part that is COMMON to both the sphere and the plane.
You can also use the "inverse" keyword.
--
Alain
-------------------------------------------------
I hope our wisdom will grow with our power, and teach us, that the less we
use our power the greater it will be.
Thomas Jefferson
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|