Grandtour,
there's a good function that always works when interpolating linearly
between two tensors (be they numbers, vectors, points... any kind of
data that can be blended)
If you have 2 values (A & B) and you want to interpolate between them
at f (a blending factor), the function is always:
R = A + f * (B-A)
For example, let's fill in a few numbers and see what happens... Let's
assume we want to find the value one quarter along the way between 15
and 19:
R = 15 + 0.25 * (19-15)
R = 16
Or, let's go twice beyond two points {10, 10, 0} and {12, 15, 4}
R = {10, 10, 0} + 2.0 * ({12, 15, 4} - {10, 10, 0})
R = {10, 10, 0} + 2.0 * ({2, 5, 4}) <---- if you subtract two
points you get the vector going from A to B
R = {10, 10, 0} + {4, 10, 8}
R = {14, 20, 8}
This function is handy because it works without division (no division
by zero errors), it works well when A is larger than B and it works
for every value of f (i.e. you can also use it to extrapolate).
--
David Rutten
[email protected]
Robert McNeel & Associates
ps. if someone starts a reply with "I don't mean to be rude" it's best
to assume they mean it.
On Apr 28, 9:25 pm, Grandtour <[email protected]> wrote:
> Now I can find the 1/3 point by "On3dPoint((points(i - 1) * 2 + points
> (i) ) / 3)“
>
> On Apr 29, 2:57 am, Grandtour <[email protected]> wrote:
>
> > I made a mistake that the way to find the 1/3 possition is really
> > wrong. But that is not my point of question.
>
> > On Apr 29, 2:54 am, Grandtour <[email protected]> wrote:
>
> > > You are really rude, visose .
>
> > > Did you really got what I mean?????????
>
> > > I think you should go back to school to learn literature .
>
> > > In my mind , if I need to find the middle point, in rhino script, I
> > > should find the x,y,z coordinate and do calculate on them. There is
> > > nothing about vector, nothing about wikipedia.
>
> > > I just want to know the ghVB logic.
>
> > > Now do you got my point?
>
> > > On Apr 29, 12:46 am, visose <[email protected]> wrote:
>
> > > > > HOW DOES HE KNOW "points(i - 1) + points(i)) / 2" is middle point?
>
> > > > I don't mean to be rude, but maybe he studied maths in elementary
> > > > school.
> > > > It has nothing to do with vb.net, it's got to do with geometry and the
> > > > math behind it. Look up in Wikipedia about vectors, cartesian
> > > > coordinate system, etc.
>
> > > > On Apr 28, 3:43 pm, Grandtour <[email protected]> wrote:
>
> > > > > I found a good gh VB example on wiki. In his VB , when he want to find
> > > > > the middle point of two points. he use "points(i - 1) + points(i)) /
> > > > > 2"
>
> > > > > I want to know , why this means finding the middle point of two
> > > > > points???? And how does he know this???? In VB examples, I usually
> > > > > find such kind of transcendent thing, how can I learn them?
>
> > > > > In fact, I am a new learner and want to learn VB for gh. BUT can not
> > > > > find a good way to learn. I have read the 2nd primer, did not get any
> > > > > point. And then I want to recite some VB example , just like the way I
> > > > > learn foreign language, Is that a good way?- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -