From issues-return-69695-archive-asf-public=cust-asf.ponee.io@commons.apache.org Tue Sep 18 15:08:09 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 68B80180672 for ; Tue, 18 Sep 2018 15:08:09 +0200 (CEST) Received: (qmail 11371 invoked by uid 500); 18 Sep 2018 13:08:08 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 11354 invoked by uid 99); 18 Sep 2018 13:08:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2018 13:08:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id BF43AC03A4 for ; Tue, 18 Sep 2018 13:08:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id lIYJXLTlNzm3 for ; Tue, 18 Sep 2018 13:08:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 2C4B85F516 for ; Tue, 18 Sep 2018 13:08:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 76530E02BE for ; Tue, 18 Sep 2018 13:08:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3867723F9C for ; Tue, 18 Sep 2018 13:08:01 +0000 (UTC) Date: Tue, 18 Sep 2018 13:08:01 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GEOMETRY-17) Euclidean Vector Method Follow-Up MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GEOMETRY-17?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D166= 19082#comment-16619082 ]=20 Gilles commented on GEOMETRY-17: -------------------------------- bq. getRealNonZeroNorm() Sorry to be a bit late, but I don't think it is a good idea to have this on= e in a public interface. Rationale is that it is a strange combination of i= mplementation detail (infinities caused by limited range), check on user in= put (non-zero norm as precondition), and stopping NaN propagation, with the= side effect of throwing an exception. How about this interface method instead: {code} /** @return true if the norm is finite, not zero (or equivalent within the = expected accuracy context) and not NaN, false otherwise. */ boolean isFinite(); {code} ? A separate (syntactic sugar) method for raising an exception: {code} class Vectors { public static double checkedNorm(Vector vector) { if (vector.isFinite()) { return vector.getNorm(); } throw new IllegalNormException(); } } {code} to be used in places where validation is enforced. This would replace the c= urrent {{ensureFiniteNonZeroNorm}} which is longish (and not clearer as to = what is does to "ensure"). In some other places, validation could perhaps be bypassed (even if an erro= r could be detected) because, in case of valid usage, it would be redundant= . I think that the {{angle}} method may be such a place where infinities o= r NaN could be propagated (as they probably result from failing to validate= earlier). > Euclidean Vector Method Follow-Up > --------------------------------- > > Key: GEOMETRY-17 > URL: https://issues.apache.org/jira/browse/GEOMETRY-17 > Project: Apache Commons Geometry > Issue Type: Improvement > Reporter: Matt Juntunen > Priority: Major > > This is a follow-up issue to GEOMETRY-9. The following tasks should be co= mpleted: > # Vector2D - needs an orthogonal() method like Vector3D > # Vector#getMagnitude() should be removed. I originally added this as pa= rt of GEOMETRY-9 as an alias for getNorm(), but after thinking about it mor= e and working with it, I believe it's more confusing than useful to have mu= ltiple names in the code base for the same idea. > # Vector#withMagnitude() should be renamed to Vector#withNorm() for the = same reason as above. > # Vector#getRealNonZeroNorm() - This is currently a private method in th= e Vector implementation classes but I believe it is useful enough to be mad= e public. The idea is that this would return the vector norm but throw an I= llegalNormException if the norm is zero, NaN, or infinite. I've already com= e across some places in other classes (such as Rotation) where I want to us= e this. > =C2=A0 > Pull request: https://github.com/apache/commons-geometry/pull/11 -- This message was sent by Atlassian JIRA (v7.6.3#76005)