mesh intersection = deletion

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 01 January 2012   #1
mesh intersection = deletion

I'm sure this question has been asked before.
I simply just want to take a select of objects and run a script which would delete them based on whether or not they test true for colliding meshes (*not bounding boxes)

Example:Image
delete all blue boxes which intersect with ring.
Attached Images
File Type: jpg Untitled-1.jpg (90.1 KB, 166 views)
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 01 January 2012   #2
Maybe do IntersectRayEX I believe, from each box upwards, and see if it hits any nodes (donut) and if it does, delete it.
 
Old 01 January 2012   #3
This partially works but I'm not sure if it is the best way to go about doing so?
Thoughts everyone?


fn find_intersection z_node node_to_z =
(
	local testRay = ray node_to_z.pos [0,0,-1]
	local nodeMaxZ = z_node.max.z
	testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ
	intersectRay z_node testRay
)

for i in selection do
(
	int_point = find_intersection $Circle001 i
	if int_point != undefined then i.wirecolor = blue
)--end i loop
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 01 January 2012   #4
Yeah, I mixed it up, was thinking of intersectScene, but ya, your method works well.

I'm not sure how else you'd do it? Your method seems clean and fast.
 
Old 01 January 2012   #5
Well It says the z direction right now.
I was wondering if it checks an object in all directions because it seems to be missing some object right now when i run it.


It surprisingly runs fast than i expected it to.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 01 January 2012   #6
Originally Posted by Kickflipkid687: Yeah, I mixed it up, was thinking of intersectScene, but ya, your method works well.

I'm not sure how else you'd do it? Your method seems clean and fast.


is the VolumeSelect modifier too boring?
 
Old 01 January 2012   #7
Didn't know about that.
 
Old 01 January 2012   #8
So is that the best way to test this scenario?

It seems to miss objects when i test it?
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 01 January 2012   #9
Originally Posted by JokerMartini: This partially works but I'm not sure if it is the best way to go about doing so?
Thoughts everyone?


 fn find_intersection z_node node_to_z =
 (
 	local testRay = ray node_to_z.pos [0,0,-1]
 	local nodeMaxZ = z_node.max.z
 	testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ
 	intersectRay z_node testRay
 )
 
 for i in selection do
 (
 	int_point = find_intersection $Circle001 i
 	if int_point != undefined then i.wirecolor = blue
 )--end i loop
 


it might be a solution for only very specific cases. in real life the geometry intersection is very complicated thing. to make the calculation faster real-time engines use some tricks, i.e. get intersection bbox with bbox, bound primitive (box, sphere, cylinder, capsule) with a primitive, convex hulls intersection...
so this kind of task has to be simplified for getting enough accuracy.
if you need true intersection one of most popular technique is voxel (grid) method. to get progressive accuracy some techniques use the octree methods. there are some good octree c# free libraries in internet. try to find...
 
Old 01 January 2012   #10
Where could I find examplea to do so using bouding primitive it convex hulls. Is like to stick within maxscriot and not expand to c# for the time being thanks though for letting me know as that being an option.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 01 January 2012   #11
Originally Posted by JokerMartini: So is that the best way to test this scenario?

It seems to miss objects when i test it?

I have a feeling that you are looking for a method that is fast and accurate at the same time, if so you chasing a ghost.
__________________
* everyone can win previous war
 
Old 01 January 2012   #12
Is doing a convex hull type of calculation something that would be a little more accurate and better?
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 01 January 2012   #13
My recent Shrink Wrap script I made can do convex hulls in a sense, which I didn't plan in the first place.

You could do the same, which wouldn't be necessarily 100% accurate, but is fast and should work for what u want. I just use MeshProjIntersect() for something like on your donut, and take a geosphere, and for each vert in the geo sphere, get the closest hit pos on the donut to make ur convex hull.

Then from there just do raycast like before at the convex hull?
 
Old 01 January 2012   #14
Originally Posted by Kickflipkid687: You could do the same, which wouldn't be necessarily 100% accurate, but is fast and should work for what u want. I just use MeshProjIntersect() for something like on your donut, and take a geosphere, and for each vert in the geo sphere, get the closest hit pos on the donut to make ur convex hull.

this method can't guaranty that the projected object will be convex.
 
Old 01 January 2012   #15
It's ok if it is a little rough. That sounds a possible solution or something to build off of.
Would there be a possible way to do primitive based calculations. Like box or sphere ? Like bounding box. Unless there is a convex solution.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:49 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.