Itoo Software Forum

Author Topic: Problem scaling segment to "best fit" (arithmetic)  (Read 6618 times)

George

  • Full Member
  • ***
  • Posts: 122
Problem scaling segment to "best fit" (arithmetic)
« on: December 11, 2013, 01:39:46 AM »
I've attached a file showing what i'm trying to do. Here's some pseudo-code:

segmentWidth = 4.2
sectionLength = XSectionLength

newSegmentWidth = sectionLength / floor(sectionLength / segmentWidth)

scaleFactor = (newSegmentWidth / segmentWidth) * 100

But it's not doing this, and the one time it was working, it seemed to be working at low-precision (I was getting gaps and snapping).

George

  • Full Member
  • ***
  • Posts: 122
Re: Problem scaling segment to "best fit" (arithmetic)
« Reply #1 on: December 11, 2013, 08:47:55 AM »
Ok, it's definitely casting everything to integers. Piping the output of an expression to, say, ScaleX makes no difference if it's 8.0-1.0 or 8.0-0.01.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 4388
    • iToo Software
Re: Problem scaling segment to "best fit" (arithmetic)
« Reply #2 on: December 11, 2013, 12:27:14 PM »
I can confirm the bug: some arithmetic expressions are evaluated as integer values. We've already identified and fixed the problem in our internal build.

Have you considered to use the new Adaptive mode ? I think it does exactly what you need. If not, we would prepare a custom patch for you.
Carlos Quintero
iToo Software

George

  • Full Member
  • ***
  • Posts: 122
Re: Problem scaling segment to "best fit" (arithmetic)
« Reply #3 on: December 11, 2013, 10:50:29 PM »
I'm doing something a bit more complicated, where some segments should stretch to fit and others should be fixed (using a sequence node). A patch would be much appreciated!

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 4388
    • iToo Software
Re: Problem scaling segment to "best fit" (arithmetic)
« Reply #4 on: December 12, 2013, 08:45:14 AM »
Please, tell me your Max version. We'll prepare it.
Carlos Quintero
iToo Software

George

  • Full Member
  • ***
  • Posts: 122
Re: Problem scaling segment to "best fit" (arithmetic)
« Reply #5 on: December 12, 2013, 10:54:58 PM »
Max 2014 64 (and the rendernode too if it's different!)

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 4388
    • iToo Software
Re: Problem scaling segment to "best fit" (arithmetic)
« Reply #6 on: December 13, 2013, 10:13:46 AM »
I just sent you the patch by e-mail. Render nodes use the same files.
Carlos Quintero
iToo Software

George

  • Full Member
  • ***
  • Posts: 122
Re: Problem scaling segment to "best fit" (arithmetic)
« Reply #7 on: December 13, 2013, 10:21:36 AM »
Thanks Carlos!

I actually used a work-around to get the job out today, but I'm going to have a play with this on Monday.