Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 147F817EED for ; Mon, 1 Jun 2015 13:27:20 +0000 (UTC) Received: (qmail 63725 invoked by uid 500); 1 Jun 2015 13:27:19 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 63603 invoked by uid 500); 1 Jun 2015 13:27:19 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 63291 invoked by uid 99); 1 Jun 2015 13:27:17 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2015 13:27:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id EAED71A41BA for ; Mon, 1 Jun 2015 13:27:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.02 X-Spam-Level: X-Spam-Status: No, score=-0.02 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=scarlet.be Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id vpqkfci7p7Ff for ; Mon, 1 Jun 2015 13:27:10 +0000 (UTC) Received: from sif.is.scarlet.be (sif.is.scarlet.be [193.74.71.28]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id B257547BE8 for ; Mon, 1 Jun 2015 13:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scarlet.be; s=scarlet; t=1433165228; bh=+veqy5Xf5DBV1sL+yZYa9KCy0b8nkMmfF7Zca7/+LJo=; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Date:From:To: Subject:In-Reply-To:References:Message-ID; b=xdHYo1PoL256toQ8D5DGJPg8dAYiTbHLaAG33JaumU94mtktZdeyF6Wp64Y3KAENx xc66UboLMhx9rsJNrem5p0DfotU6Jld0YGF0gYTt7C/RUDkE/mSGjKDZGciJv5yjpv yAehgL7jhVAk++CH+kGIVanOhGub5rWpkcagI4po= Received: from webmail.scarlet.be (gresham.is.scarlet.be [193.74.71.215]) by sif.is.scarlet.be (8.14.9/8.14.9) with ESMTP id t51DR8bv030202 for ; Mon, 1 Jun 2015 15:27:08 +0200 X-Scarlet: d=1433165228 c=193.74.71.215 Received: from ip-83-134-185-194.dsl.scarlet.be ([83.134.185.194]) via ip-83-134-185-194.dsl.scarlet.be ([83.134.185.194]) by webmail.scarlet.be with HTTP (HTTP/1.1 POST); Mon, 01 Jun 2015 15:27:08 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Mon, 01 Jun 2015 15:27:08 +0200 From: Gilles To: Subject: Re: [Math] Allow empty "ConvexHull2D" In-Reply-To: <2e3e914e4d4cf8cd101874a8942e204a@smtp.spaceroots.org> References: <2e3e914e4d4cf8cd101874a8942e204a@smtp.spaceroots.org> Message-ID: <22ee2f0419d0851b030dd065db702e1b@scarlet.be> X-Sender: gilles@harfang.homelinux.org User-Agent: Scarlet Webmail X-DCC-scarlet.be-Metrics: sif; whitelist X-Virus-Scanned: clamav-milter 0.98.1-exp at sif X-Virus-Status: Clean Hello. On Mon, 01 Jun 2015 15:03:47 +0200, luc wrote: > Le 2015-06-01 14:38, Gilles a écrit : >> Hi. > > Hi Gilles, >> I have a question regarding >> public Region createRegion() throws >> InsufficientDataException >> in ConvexHull2D. >> It throws the exception when the number of points is < 3. >> One can imagine that rather than aborting it could return an "empty >> Region" >> (which would seamlessly work with further operations on the Region). >> What do you think? >> Context: in the course of a program, a "valid" region can undergo >> successive >> transformation until it is indeed impossible to compute the hull; it >> seems >> that it would be interesting to not treat that as a hard-failure >> (warranting >> an exception). > > I'm on the fence on this. The exception is advertised right at the > the top > interface level (ConvexHull in o.a.c.m.geometry.hull package) and > clearly intended > to cover this case. An empty region could be expected from computing > the hull of n >= 3 aligned points, but n < 3 points is something > different to me. This is how I get the "Region" in my program: final ConvexHullGenerator2D hullGen = new MonotoneChain(false); final ConvexHull2D hull = hullGen.generate(data); final Region hullRegion = hull.createRegion(); So, I note that "generate" did not raise an exception whereas the computation request could be deemed invalid. Then "createRegion" raises an exception... Something looks wrong here: if the "hull" instance is valid (from a programming perspective), then "hullRegion" should be valid too (i.e. "empty"). Assuming that you don't want to change the existing code, how can I create an empty region? Is there a singleton instance to represent the concept? Thanks, Gilles > > best regards > Luc --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org