[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Orekit Users] Advice on FastMath.toRadians
- To: "orekit-users@orekit.org" <orekit-users@orekit.org>
- Subject: RE: [Orekit Users] Advice on FastMath.toRadians
- From: Bogdan Udrea <bogdan.udrea@vissidus.com>
- Date: Thu, 19 Jul 2018 19:18:59 +0000
- Accept-language: en-US
- Authentication-results: kepler.orekit.org; dkim=pass reason="1024-bit key; insecure key" header.d=VissidusTechnologiesInc.onmicrosoft.com header.i=@VissidusTechnologiesInc.onmicrosoft.com header.b=L9QF9WmZ; dkim-adsp=none (insecure policy); dkim-atps=neutral
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=bogdan.udrea@vissidus.com;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=VissidusTechnologiesInc.onmicrosoft.com; s=selector1-vissidus-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bx6ulduiumB7Vc8gJI2k2cQqZQ7Qmdj/RCuZKZvk2vA=; b=L9QF9WmZchB6lKbw8nEOX5OxY6GqYmXQr9ExVd6WzG6EtJAiOFUpjtKLHLGN0ST34t7gGp8GWSIymaGVmNpzSo/l7ME1mhsPS+h+aM/WAgHDtwm53rqfRIpdDVITUyAI4fJngDRps4TxsURQaE/eTn+t63ff8kjb0sxSXpq/w5k=
- In-reply-to: <20180719162234.Horde.DMBBIiWlt421JcFHkm21OA7@messagerie.c-s.fr>
- References: <sympa.1531961612.22542.839@orekit.org> <20180719162234.Horde.DMBBIiWlt421JcFHkm21OA7@messagerie.c-s.fr>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
- Thread-index: AQHUH2v1ydd9qUPnIU+HKJL+esGamaSW6vjg
- Thread-topic: [Orekit Users] Advice on FastMath.toRadians
Luc,
Thank you for your help. It works great.
Lambda functions are new to me and now I see quite a few places where I can use them in the code.
Best regards,
Bogdan
-----Original Message-----
From: orekit-users-request@orekit.org <orekit-users-request@orekit.org> On Behalf Of MAISONOBE Luc
Sent: Thursday, July 19, 2018 10:23
To: orekit-users@orekit.org
Subject: Re: [Orekit Users] Advice on FastMath.toRadians
bogdan.udrea@vissidus.com a écrit :
> Dear Colleagues,
>
> This might be better asked on the Hipparchus listserv but I have
> decided to ask it here as well.
>
> I am using an XML file to store the parameters of a simulation where I
> specify Euler angles for a multitude of sensors. The Euler angles are
> stored in the XML file in degrees so they are easy to read by humans.
> The angles are converted to radians in the code in a loop.
>
> // Euler angles so that the Ox axis of sensors points radially out //
> rotation order of Euler angles is ZYX double [] senEulerAng =
> senParams.getEulerAngles(); for ( int i = 0; i < senEulerAng.length;
> ++i ) { // converts to rad
> senEulerAng[i] = FastMath.toRadians( senEulerAng[i] ); }
>
> The question: Is it possible to apply FastMath.toRadians as an
> iterator on an array of doubles? I haven't been able to figure it out on my own.
You may try this, if senEulerAng is declared as final so it is available in the context of the lambda generator function:
Arrays.setAll(senEulerAng, i -> FastMath.toRadians(senEulerAng[i]));
best regards,
Luc
>
> A solution would be to convert the array of doubles to a RealVector,
> mapMultiuply with pi/180, and then convert back to an array of doubles
> but it seems like a workaround instead of elegant Java.
>
> Thank you.
>
> Bogdan