by thomthom » Tue Dec 01, 2009 12:30 pm
qpik wrote:plane = [face.vertices[0].position, face.normal]
You can use face.plane instead qpik wrote:This could be optimized by passing pre-sorted face array (based on results from previous tests) instead of browsing entities array, but I doubt it would speed it up much. What do you think?
hmm... If you only iterate the entities collection once then it won't help to pre-process to filter out only faces. Infact, that would mean more iterations. But if you need to iterate the face multiple times, then you will save time on pre-filtering. qpik wrote:I thought exactly the same, as it returns "the first thing that the ray hits". I suppose it means "the closest thing". For my purpose it's enough to get first-on-the-list hit end exit.
Isn't that the same thing? qpik wrote:I quickly wrote this, but it worked MUCH slower than original method.
You're writing a ruby method to be faster than a C method - that C method must be doing a lot of extra processing in order to be able to out-perform it in Ruby.
-

thomthom
- Global Moderator
-
- Posts: 17915
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by qpik » Thu Dec 17, 2009 12:47 am
thomthom wrote:You can use face.plane instead
Somehow I didn't notice that one in the API  thomthom wrote:hmm... If you only iterate the entities collection once then it won't help to pre-process to filter out only faces. Infact, that would mean more iterations. But if you need to iterate the face multiple times, then you will save time on pre-filtering.
I meant to sort the collection before proceeding to the next testing point. The faces that got hit before might as well be the first to get hit by rays cast from adjacent point. thomthom wrote:qpik wrote:I thought exactly the same, as it returns "the first thing that the ray hits". I suppose it means "the closest thing". For my purpose it's enough to get first-on-the-list hit end exit.
Isn't that the same thing?
I suppose model.raytest doesn't break after first positive ray hit, but returns the closest one from an array of all. thomthom wrote:qpik wrote:I quickly wrote this, but it worked MUCH slower than original method.
You're writing a ruby method to be faster than a C method - that C method must be doing a lot of extra processing in order to be able to out-perform it in Ruby.
That is certainly true. That is why I managed to connect with a DLL using Win32api.call (BTW thanks to TBD for his SUDLL example). Now I'm on my way to moving everything to C. I hope this will finally give a speed boost. I'm looking into Ruby-OpenGL as well for another approach. Here is an example - viewtopic.php?f=180&t=20893&p=209966#p209966
-
qpik
-
- Posts: 33
- Joined: Thu May 28, 2009 9:46 am
- Location: Poland
by thomthom » Thu Dec 17, 2009 8:30 am
qpik wrote:I suppose model.raytest doesn't break after first positive ray hit, but returns the closest one from an array of all.
that would be very odd. if it did produce a full array before returning I think it should return the full array.
-

thomthom
- Global Moderator
-
- Posts: 17915
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by qpik » Thu Dec 17, 2009 9:49 am
But then how would it find out the closest intersection?
ps. I write all this out of my head, I'm not familiar with 3d algorithms.
-
qpik
-
- Posts: 33
- Joined: Thu May 28, 2009 9:46 am
- Location: Poland
by tomasz » Thu Dec 17, 2009 9:50 am
qpik wrote:I suppose model.raytest doesn't break after first positive ray hit, but returns the closest one from an array of all.
I think it does break after first positive hit. Make sure you check if the object is not hidden or on a hidden layer, otherwise your rays will stop too early when hidden layer present in a model.
-
tomasz
- SU2TH & SU2KT Developer
-
- Posts: 789
- Joined: Fri Nov 16, 2007 8:46 pm
- Location: Poland
- Name: Tomasz
- Operating system: Windows
- SketchUp version: 8
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by qpik » Thu Dec 17, 2009 10:36 am
Yeah, but how would the method know if the first hit is the closest? It could be for example some distant face that got hit first, because it was first in the collection.
-
qpik
-
- Posts: 33
- Joined: Thu May 28, 2009 9:46 am
- Location: Poland
by thomthom » Thu Feb 25, 2010 11:10 am
Did you ever find any improvements that could be made?
-

thomthom
- Global Moderator
-
- Posts: 17915
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by qpik » Tue Mar 16, 2010 3:14 pm
I planned writing new method in C and calling it via Win32api... but I never find time and enough determination to do it. I wish somebody else did it instead  , someone who knows C, unlike me.
-
qpik
-
- Posts: 33
- Joined: Thu May 28, 2009 9:46 am
- Location: Poland
by thomthom » Tue Mar 16, 2010 3:37 pm
I'm also an C ignorant... 
-

thomthom
- Global Moderator
-
- Posts: 17915
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by KiraNL » Sun Jul 10, 2011 6:59 pm
Any chance this ever might come out which works for round shapes? Love to use this as subtile shadows over the textures, sort of lighting baking.
-
KiraNL
-
- Posts: 31
- Joined: Wed Feb 13, 2008 10:04 pm
- Name: KiraNL
by seikun » Mon Feb 27, 2012 7:21 am
how can i download the plug-in
-
seikun
-
- Posts: 1
- Joined: Mon Feb 27, 2012 7:18 am
- Name: Seikun
by Gaieus » Mon Feb 27, 2012 9:15 am
It's attached to the first post of the topic. But it is not yet tested on SU version 9 - so it may not work for you (unless you made a typo when registering in which case, could you correct it, please?). 
Gai...
-

Gaieus
- Administrator
-
- Posts: 27729
- Joined: Sat Oct 20, 2007 8:24 am
- Location: Pécs, Hungary
- Name: Csaba Pozsárkó
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: historical reconstruction
- Level of SketchUp: Advanced
-
by tomasz » Mon Feb 27, 2012 10:00 am
Hi Kuba, Nice to see another Polish architect in action as a programmer.  I am getting more and more comfortable with C++, but I do not expect to be able to help you within next few months. I won't forget you effort and if I will find time, I will see whether I can help you with the raytest issue.
-
tomasz
- SU2TH & SU2KT Developer
-
- Posts: 789
- Joined: Fri Nov 16, 2007 8:46 pm
- Location: Poland
- Name: Tomasz
- Operating system: Windows
- SketchUp version: 8
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by Dan Rathbun » Sat Dec 22, 2012 4:57 am
This " plugin" (using the term liberally,) has been NOMINATED for QUARANTINE. see: [Candidate] Quarantine: Ambient Occlusion by qpik
-

Dan Rathbun
- Top SketchUcator
-
- Posts: 4146
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by Dan Rathbun » Mon Jan 07, 2013 9:49 am
NOTICE: Preliminary Overhaul of the SimpleRays plugin !Developers' forum: [Plugin] Qpik::SimpleRays OVERHAULI did this overhaul so we can remove SimpleRays from the Quarantine ListJakub, where are you ? 
-

Dan Rathbun
- Top SketchUcator
-
- Posts: 4146
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
Return to Plugins
|