Python derivativeat

What is the second needed argument ‘‘Int32?’’

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_DerivativeAt.htm

Int32 = integer or int. It’s would be good to learn a bit of the basic terminology when you get a chance.

1 Like

I did not test this, but this might help anyways. If I understand the method correctly it gives you the derivates of curves at a certain position t on this curve (which is specified with the first parameter).

The second parameter is an integer, that specifies how many derivates you want to have. The method then return an array of all the derivates as vectors.

I.e.

crv[0].DerivativeAt(0.5, 1) returns you the first derivative at the position 0.5 on the curve.
crv[0].DerivativeAt(0.5, 2) returns you the first and the second derivative at the position 0.5 on the curve.
crv[0].DerivativeAt(0.5, 3) returns you the first, the second and the third derivative at the position 0.5 on the curve.

crv[0].DerivativeAt(0.5, 0) is allowed but I do not understand the purpose.

Thank you :slight_smile:
I expected it to be something similar like component evaluate length, which gives points, but this one does not give points.

Do you know the python thing that does that - making points by length - similar to that component?

I have distances and I want to input it so I get points on the curve within python.

To get the point on a specific position of the curve use the method Curve.PointAt().

E.g.
crv.PointAt(0) will return the starting point
crv.PointAt(0.5) will return the middle point on a normalized curve
crv.PointAt(1) will return the end point on a normalized curve

If you do not want to normalize the curve you can use the method Curve.PointAtNormalizedLength()

E.g.
crv. PointAtNormalizedLength(0) will return the starting point
crv. PointAtNormalizedLength(0.5) will return the middle point for any curve
crv. PointAtNormalizedLengtht(1) will return the end point for any curve

On a more general note, I can highly recommend trying to work with the ressources for Rhino.Common provided online, e.g. all the properties and methods a curve has

EDIT:
Oh and I think Curve.PointAtLength() does what you actually want. It gives you the point at a specific length from the starting Point

2 Likes

:slight_smile: int32 is not basic term, int is.

Do you also know how to do in python something like ‘lower and higher rate’ for selecting a value by python random?

import random as r
r.randint(0.4,2.4)
#.... what to do nex, and randint does not work on floats

or do people usually make a list with duplicates of items in order to get a higher select rating around a certain value while doing random?

Hi,
If you read the docs for random you will find r.triangular(0.4,2.4,0.4)
:slight_smile:

Ah yes it is. :grinning: You type int when using, what you are using is an int32. You should know what you are using.

Not really, people using (scripting in) Rhino are not Software Engineers. Int32 is software engineering term (computer engineering term), while Int is a math term, studied by all engineers.

Ok, dunno what to tell you. @ForestOwl you should not know the technical terms of the things you are using, especially because every api will call it int32 (like rhinocommon), apparently it is better that way, ignore the info :man_shrugging:t2:

1 Like

What I am simply pointing out is that the term is considered a technical term only from the field where it is studied. To a structural engineer Int32 means nothing, but Int means integer.

And this rational is the reason he doesn’t understand the info the method wants or what the sdk is telling him to use :grinning:. So again if you would not like to understand sdk’s, help files, or error message please by all means ignore my first comment.

1 Like

You know, I can bet there are far more mechanical/structural engineers and architects using this api than computer engineers. If you ask me the information there should be full of more colloquial terms than pure computer engineering terms.

This is what I fight for.

A computer engineer understands just their bit/byte terms, while structural/mechanical engineers are forced to understand all other engineering (applied phisics) terms plus computer engineering terms, and then the computer engineers brag how great they are. That’s just not fair. :angry:

What can I do about this?
I have an input of 0.5 at line 109, but I cannot input floats. Multiply it by 10 and then dividing it by 10 again seems to me not logic, how can I use floats, or does people multiply and divide it in these case, do you might know?

@ForestOwl if you want a float as min and max for the random generation function use this construct

from System import Random as sr

def foo(rm,rx):
    rm = rm*1000
    rx = rx*1000
    rand = sr.Next(sr(),int(rm),int(rx))/1000
    return round(rand,3)

print foo(2.5,5.5)
1 Like

No problem using floats in triangle

Read the error message again : what does subscriptable mean? Which object are you trying to subscript in that line? Are you sure that object is what you think it is?

1 Like

Yeah, I found it out. :smiley: And about something else…

random.shuffle( *x* [, *random* ])

It is not like jitter.

Like lets say:

a=[0,1,2,3,4,5]
shuffle
b=[3,1,2,4,5,0]

Do you know what if there is a jitter function? I think I use that shuffle code wrong.