Author: Laurence D. Finston
This copyright notice applies to the text and source code of this web site, and the graphics that appear on it. The software described in this text has its own copyright notice and license, which can be found in the distribution itself.
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026 The Free Software Foundation, Inc.
Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of this license is included in the file COPYING.TXT
Last updated: April 29, 2006
The type cuboid in the 3DLDF language corresponds to class Cuboid in the C++ code. class Cuboid is defined in the file cuboid.web. class Cuboid already existed in Release 1.1.5.1, so it's documented in the manual. This web page contains examples and illustrations of newer features.
points can be classified according to their position with respect to a cuboid by using the location operator:
cuboid c; c := unit_cuboid scaled (20, 16, 10) rotated (-20, 15); draw c; point p[]; p0 := (0, 1, 1); message "p0 location c:"; show p0 location c; rectangle r[]; r0 := get_rectangle 0 c; p1 := mediate(get_point 0 r0, get_point 3 r0, 1/3); message "p1 location c:"; show p1 location c; r1 := get_rectangle 4 c; p2 := mediate(get_point 0 r1, get_point 2 r1) shifted (0, 2); message "p2 location c:"; show p2 location c; end;
location returns one of the following numerical values:
In the following image, p0 lies inside the cuboid, p1 on one of its edges, p2 on one of its faces, and p3 outside of it. The complete 3DLDF code for generating this image can be found in cubd_01.ldf.
[Cuboid 1]
2005年12月16日.
The following four images illustrate the intersections of a
cuboid and a linear path.
The 3DLDF code for generating these images is in
cubd_02.ldf.
[Cuboid-Linear Path Intersection 1]
Perspective Projection
[Cuboid-Linear Path Intersection 2]
Parallel Projection, X-Z Plane
[Cuboid-Linear Path Intersection 3]
Parallel Projection, X-Y Plane
[Cuboid-Linear Path Intersection 4]
Parallel Projection, Z-Y Plane
2005年12月16日.
The following four images illustrate the intersection of a
cuboid and a plane, which, in general,
is a polygon. It could also be a point, but I haven't accounted
for this case yet. The 3DLDF code for generating these images is in
cubd_06.ldf.
[Cuboid-Plane Intersection 1]
Perspective Projection
[Cuboid-Plane Intersection 2]
Parallel Projection, X-Z Plane (scaled 3/4 size)
[Cuboid-Plane Intersection 3]
Parallel Projection, X-Y Plane (scaled 3/4 size)
[Cuboid-Plane Intersection 4]
Parallel Projection, Z-Y Plane (scaled 3/4 size)