This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > February 2004 > boolean operations with vrml ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author boolean operations with vrml ?
Robert Ludewig

2004-02-03, 4:34 pm

Hello

is there a way to to boolean operations on vrml-objects.


cube3

2004-02-03, 7:31 pm

within the vrml file?
www.vizx3d.com which launched today will let you import the vrml file, do
boolean edits, then export the file back out as vrml or X3D.

c3



"Robert Ludewig" <schwertfischtrombose@gmx.de> wrote in message
news:bvp0f7$v3p3n$1@ID-140548.news.uni-berlin.de...
quote:

> Hello
>
> is there a way to to boolean operations on vrml-objects.
>
>




Robert Ludewig

2004-02-04, 3:29 am

no , I mean at runtime using the vrml, vrmlscript langauge. Maybe there is a
PROTO for that or something


Robert Lipman

2004-02-04, 12:33 pm

Robert Ludewig wrote:
quote:

>
> Hello
>
> is there a way to to boolean operations on vrml-objects.



Try the following VRML model. If you drag the blue circle around, a
hole moves around in the magenta square.

--
Bob Lipman
http://cic.nist.gov/lipman/
Cecile Muller

2004-02-04, 8:32 pm

> Try the following VRML model. If you drag the blue circle around, a
quote:

> hole moves around in the magenta square.



<dummy>Uh, where's the link ?</dummy>
Robert Lipman

2004-02-05, 11:31 am

Cecile Muller wrote:
quote:

>
>
> <dummy>Uh, where's the link ?</dummy>



Sorry, I included the VRML code as an attachment which I guess didn't go
through. Here's the VRML code.

--
Bob Lipman
http://cic.nist.gov/lipman/



#VRML V2.0 utf8

#-------------------------------------------------------------------------------

PROTO SQUARE [
eventOut MFInt32 coordIndex_changed
eventOut MFVec3f point_changed
]

{
DEF SQUARE_GEOM IndexedFaceSet {
coord DEF SQUARE_COORD Coordinate {point []}
coordIndex []
solid FALSE
}

DEF SQUARE_SCRIPT Script {
eventOut MFInt32 coordIndex_changed IS coordIndex_changed
eventOut MFVec3f point_changed IS point_changed
field SFInt32 i 0
url ["java script:
function initialize () {
point_changed[0] = new SFVec3f(-2, 2, 0);
point_changed[1] = new SFVec3f(-2, -2, 0);
point_changed[2] = new SFVec3f(2, -2, 0);
point_changed[3] = new SFVec3f(2, 2, 0);
point_changed[4] = new SFVec3f(-2, 2, 0);

for (i = 0; i < 5; i++) {coordIndex_changed[i] = i;}
coordIndex_changed[5] = -1;
}
"]
}
ROUTE SQUARE_SCRIPT.point_changed TO SQUARE_COORD.set_point
ROUTE SQUARE_SCRIPT.coordIndex_changed TO SQUARE_GEOM.set_coordIndex
}

#-------------------------------------------------------------------------------

PROTO CIRCLE [
eventIn SFVec3f set_translation
eventOut MFInt32 coordIndex_changed
eventOut MFVec3f point_changed
]

{
DEF CIRCLE_GEOM IndexedFaceSet {
coord DEF CIRCLE_COORD Coordinate {point []}
coordIndex []
solid FALSE
}

DEF CIRCLE_SCRIPT Script {
eventIn SFVec3f set_translation IS set_translation
eventOut MFInt32 coordIndex_changed IS coordIndex_changed
eventOut MFVec3f point_changed IS point_changed
field SFVec3f translation 0 0 0
field SFInt32 i 0
field SFInt32 len 0
url ["java script:
function genCircle () {
for (i = 0; i < len; i++) {
point_changed[i] = new SFVec3f(circx[i] + translation.x, circy[i] +
translation.y, 0);
}
}
function set_translation (value) {
translation = value;
genCircle();
}
function initialize () {
circx = new Array(-.5, -.462, -.354, -.191, 0., .191, .354, .462,
.5, .462, .354, .191, 0., -.191, -.354, -.462, -.5);
circy = new Array(0., .191, .354, .462, .5, .462, .354, .191,
0., -.191, -.354, -.462, -.5, -.462, -.354, -.191, 0.);
len = circx.length;
for (i = 0; i < len; i++) {coordIndex_changed[i] = i;}
coordIndex_changed[len] = -1;
genCircle();
}
"]
}
ROUTE CIRCLE_SCRIPT.point_changed TO CIRCLE_COORD.set_point
ROUTE CIRCLE_SCRIPT.coordIndex_changed TO CIRCLE_GEOM.set_coordIndex
}

#-------------------------------------------------------------------------------

PROTO Add [
eventIn SFVec3f set_translation
eventOut MFInt32 coordIndex_changed
eventOut MFVec3f point_changed
field SFNode geometry1 NULL
field SFNode geometry2 NULL
]
{
DEF ADD_GEOM IndexedFaceSet {
coord DEF ADD_COORD Coordinate {point []}
coordIndex []
solid FALSE
convex FALSE
}

DEF ADD_SCRIPT Script {
eventIn SFVec3f set_translation IS set_translation
eventOut MFInt32 coordIndex_changed IS coordIndex_changed
eventOut MFVec3f point_changed IS point_changed
field MFInt32 index1 []
field MFInt32 index2 []
field MFVec3f point1 []
field MFVec3f point2 []
field SFNode geometry1 IS geometry1
field SFNode geometry2 IS geometry2
field SFVec3f translation 0 0 0

field SFInt32 i 0
field SFInt32 j 0
field SFInt32 lp1 0
field SFInt32 lp2 0
field SFInt32 li1 0
field SFInt32 li2 0

url ["java script:
function genCircle () {
point_changed = point1;
for (i = 0; i < lp2; i++) {
point_changed[i+lp1] = point2[i];
}

iend = index1[li1 - 2] + 1;
coordIndex_changed = index1;
for (i = 0; i < li2; i++) {
if (index2[i] != -1) {
j = i + li1 - 1;
coordIndex_changed[j] = index2[i] + iend;
}
}
coordIndex_changed[j+1] = -1;
}

function set_translation(value) {
translation = value;
point2 = geometry2.point_changed;
for (i = 0; i < lp2; i++) {
point2[i].x = point2[i].x + translation.x;
point2[i].y = point2[i].y + translation.y;
}
genCircle();
}

function initialize () {
point1 = geometry1.point_changed;
index1 = geometry1.coordIndex_changed;
lp1 = point1.length;
li1 = index1.length;

point2 = geometry2.point_changed;
index2 = geometry2.coordIndex_changed;
lp2 = point2.length;
li2 = index2.length;
genCircle();
}
"]
}
ROUTE ADD_SCRIPT.point_changed TO ADD_COORD.set_point
ROUTE ADD_SCRIPT.coordIndex_changed TO ADD_GEOM.set_coordIndex
}

#-------------------------------------------------------------------------------

PROTO Red [] {Appearance {material Material {diffuseColor 1 0 0}}}
PROTO Blue [] {Appearance {material Material {diffuseColor 0 0 1}}}
PROTO Magenta [] {Appearance {material Material {diffuseColor 1 0 1}}}

Group {
children [
Transform {
translation -4 0 0
children Shape {
appearance Red{}
geometry SQUARE{}
}
}
Transform {
translation 0 0 0
children [
Shape {
appearance Blue{}
geometry DEF CIRC CIRCLE{}
}
DEF SENSOR PlaneSensor{
maxPosition 2 2
minPosition -2 -2
}
]
}
Transform {
translation 4 0 0
children Shape {
appearance Magenta{}
geometry DEF ADD Add {
geometry1 SQUARE{}
geometry2 CIRCLE{}
}
}
}
]
}
ROUTE SENSOR.translation_changed TO CIRC.set_translation
ROUTE SENSOR.translation_changed TO ADD.set_translation

NavigationInfo {type "EXAMINE" speed 50}
Background {
groundAngle [1.309 1.571]
groundColor [.2 .2 .2 .5 .5 .5 .8 .8 .8]
skyAngle [1.309 1.571]
skyColor [.4 .4 .4 .7 .7 .7 1 1 1]
}
Joerg Scheurich aka MUFTI

2004-02-06, 11:30 pm

> no , I mean at runtime using the vrml, vrmlscript langauge. Maybe there is a
> PROTO for that or something


I would guess, doing boolean operation at runtime with anything other than
simple primitives would result in performance problems 8-(

so long
MUFTI
--
Unter dem Fortschrittsbalken aus der 'Installierungs-Nuetzlichkeit' von
BitFax (Dos): 'xx Dateien links'.
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews