Hello Jerry, 1) Meshes are always rendered as triangles, so you would have to swap the green dots at the top.
2) I agree with George, your formula kind of works for debugging, but if you want to release this to the user, I would prefer truncating the string. (Maybe the result of 56/100 can't be stored in a floating point value precisely, it is either 0.5599999999999 or 0.56000000001 so in this case the conversion "fails". best, Achim Breidenbach Boinx Software On 12.05.2011, at 06:54, George Toledo wrote: > You should be able to truncate a string with the string length patch. Also, > afaik, string to number conversion works fine, so you could use it for more > than just display purposes if you wind up needing to. > > Sent from my iPhone > > On May 11, 2011, at 9:10 PM, Jerry Smith <[email protected]> wrote: > >> 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" <[email protected]> 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" <[email protected]> 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 <[email protected]> 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 ([email protected]) >>>>>> Help/Unsubscribe/Update your Subscription: >>>>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com >>>>>> >>>>>> This email sent to [email protected] >>>>> >>>> >>>> >>> >>> >> >> <StructMinMax_YES.qtz> >> <Screen shot 2011-05-11 at 8.58.22 PM.jpg> >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Quartzcomposer-dev mailing list ([email protected]) >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/quartzcomposer-dev/gtoledo3%40gmail.com >> >> This email sent to [email protected] _______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com This email sent to [email protected]

