On # 2: I haven't deeply scrutinized the patch, but maybe if you
created the data so that it had keys, you could then just search for
the keys with a structure key patch. That way, whether the order
jumbles or not within a given index probably becomes irrelevant. I
would probably also replace the structure maker with javascript;
there's no real reason to use a third party patch for that function.
There are some caveats with that though...

The thing that will sort of suck if this patch gets bigger is that
you'll find that the time that it takes a patch to load with many
structure makers in it will become unwieldy and maybe prevent the file
from opening/apps from running on some systems, but if you replace it
with javascript that does over a hundred ports or so, it will become
unstable and crashy when you try duplicating macros, etc. At that
point, the only solution is to make a new plugin (sounds like I've
been through this recently, huh?...).If it's going to stay small,
neither scenario is likely to rear it's ugly head.

On Thu, May 12, 2011 at 3:26 AM, Jerry Smith <je...@sonsmi.com> wrote:
> Okay, a couple things are sorted:
>
> 1. I found String Truncate to deal with floating point error in my number
> display.
>
> 2. I have at least figured out that when I use four points to make a
> polygon/mesh, quadrant order is TL, BL, TR, BR. Now at least the issues with
> folding become more clear for acute/obtuse/reflex angles (convex/concave).
> Not sure yet how to sort for cases with points in same quadrant -- advice
> welcome on general concepts / resources for dealing with polygons, folding,
> sorting points, etc. I see how the issues get into openGL issues, folding /
> unfolding 3D structures, texturing, etc. I am interested in simpler
> configurations of points right now, though I do seek solutions for sorting
> arbitrary number of points (structures).
>
> Thanks again, Achim, for the js help.
>
> Jerry
>
>
>
> Achim! Your method worked! Thank you. :)
>
> Next questions (see screenshot):
> 1. How can I keep the planes from overlapping in the generated mesh? In the
> attached comp I am generating in quadrant corners (TL, BL, BR, TR). I guess
> the ordering of points gets jumbled?
> 2. How can I truncate the floating point error in the number display? Right
> now I have a math expression patch with "(floor(x*100))/100".
>
> Any help is appreciated.
>
> Jerry
>
>
>
> On 5/11/11 7:58 AM, "Achim Breidenbach" <ac...@boinx.com> wrote:
>
>> Hi Jerry,
>>
>> I am not sure what you are trying to archive, but if you want to find the
>> bounding box for a 3D object defined by 3 points, you have to evaluate the
>> min/max for each component separately. Also you have to compare each point
>> against the current min/max you already calculated:
>>
>> something like this:
>>
>> _Mins = new Array(9999,9999,9999);
>> _Maxs = new Array{-9999,-9999,-9999);
>>
>> for(var point=0; point<Points.length; point ++){
>>
>> for(var component=0 ; component<3; component ++){
>>
>> if( _Mins[component] > Points[point][component]){
>> _Mins[component] =  Points[point][component];
>> }
>> if( _Maxs[component] < Points[point][component]){
>> _Maxs[component] =  Points[point][component];
>> }
>>
>> }
>>
>> }
>>
>>
>> Please note: This is untested code, I just typed it in the email. (missing 
>> all
>> the "main-function"-wrapping)
>>
>> The result is a _Mins and _Maxs array having 3 components each, containing 
>> the
>> min and max values for x , y and z of all points. Makes six numbers total. Is
>> this what you need?
>>
>> best,
>>
>> Achim Breidenbach
>> Boinx Software
>>
>>
>>
>> On 11.05.2011, at 11:07, Jerry Smith wrote:
>>
>>> Here's another revision, still the same problem. Not yet getting something
>>> crucial:
>>>
>>> _Mins = []
>>> _Maxs = []
>>>
>>> function (__structure min, __structure max) main (__structure Points)
>>> {
>>>    var result = new Object()
>>>    if (Points != null) {
>>>
>>>        for (var i=0; i < Points.length; ++i) {
>>>        _Mins = [Math.min(Points[0][0], Points[i][0]),
>>> Math.min(Points[0][1], Points[i][1])];
>>>        }
>>>
>>>        for (var j=0; j < Points.length; ++j) {
>>>        _Maxs = [Math.max(Points[0][0], Points[j][0]),
>>> Math.max(Points[0][1], Points[j][1])];
>>>        }
>>>    }
>>>    result.min = _Mins;
>>>    result.max = _Maxs;
>>>    return result
>>>
>>> }
>>>
>>>
>>>
>>>
>>> On 5/10/11 11:05 PM, "Achim Breidenbach" <ac...@boinx.com> wrote:
>>>
>>>> Hi Jerry,
>>>>
>>>> First question: The "m=0" line belongs outside the for-loop for sure,
>>>> otherwise m will always be 0 or 1 for the following lines, alway
>>>> overwriting previouse stored _Mins and _Maxs.
>>>>
>>>> Also "m++" means increase m after evaluating the code line. In the
>>>> following line m is 1 and will be increase again. The result is that
>>>> in the _Mins array only the even idexes get set, and in the _Maxs the
>>>> odd indexes. I guess you want to change the first "m++" to just "m",
>>>> but then "m" goes with "i" which means that "m" is obsolete and can be
>>>> replaced by i.
>>>>
>>>> Best,
>>>>
>>>> Achim Breidenbach
>>>> Boinx Software
>>>>
>>>> On 11.05.2011, at 02:11, Jerry Smith <je...@sonsmi.com> wrote:
>>>>
>>>>> I realize this is double posting from this kineme forum thread:
>>>>> http://kineme.net/forum/Discussion/General/JavascriptMinMax
>>>>>
>>>>> Sorry. In the meantime I reduced the comp to the essential parts. I am
>>>>> trying to set up an approach to getting a bounding box (and eventually a
>>>>> cube) for polygons with arbitrary # of points. Comp uses Kineme Structure
>>>>> Tools and GL Tools. I have 3 questions in order of importance:
>>>>>
>>>>> 1. Re: getting the min/max from an array. This js (as well as the attempt
>>>>> using the iterator in the comp) only grabs the first and last points in 
>>>>> the
>>>>> structure of 4 points. What am I doing wrong here:
>>>>>
>>>>> [javascript]
>>>>> _Mins = []
>>>>> _Maxs = []
>>>>>
>>>>> function (__structure min, __structure max) main (__structure Points)
>>>>> {
>>>>>   var result = new Object()
>>>>>
>>>>>   if (Points != null) {
>>>>>       for (var i=0; i < Points.length; ++i) {
>>>>>       m = 0
>>>>>
>>>>>       _Mins[m++] = [Math.min(Points[0][0], Points[i][0]),
>>>>> Math.min(Points[0][1], Points[i][1])];
>>>>>       _Maxs[m++] = [Math.max(Points[0][0], Points[i][0]),
>>>>> Math.max(Points[0][1], Points[i][1])];
>>>>>
>>>>>       }
>>>>>   }
>>>>>   result.min = _Mins;
>>>>>   result.max = _Maxs;
>>>>>   return result
>>>>>
>>>>> }
>>>>> [/javascript]
>>>>>
>>>>> 2. How can I send points in order to keep mesh corners from folding over?
>>>>>
>>>>> 3. In the number stats display, how can I truncate to decimal places and
>>>>> avoid the jumps caused by floating point error?
>>>>>
>>>>> <StructMinMax2.qtz>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com
>>>>>
>>>>> This email sent to ac...@boinx.com
>>>>
>>>
>>>
>>
>>
>
> ------ End of Forwarded Message
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/quartzcomposer-dev/gtoledo3%40gmail.com
>
> This email sent to gtole...@gmail.com
>
>



-- 
George Toledo
gtole...@gmail.com
www.georgetoledo.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to