text:
Archived

This topic is now archived and is closed to further replies.

This topic is 5759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Is there a way I can get the size of a structure without having to manually calculate it? I can't use "sizeof" because it compensates for compiler padding. What I did find was a post that mentioned using #pragma around your structure definition like so: #pragma pack (push, 1) struct TEST { // Data members here }; #pragma pack (pop) Then sizeof works. But is this something I should use or is there a better way of doing it? [edited by - JohnG on April 17, 2002 6:48:08 PM]

Share on other sites
thats a decent way of doing it, im pretty sure GCC does it as well. you could always do a sizeof on all the members of the class too, kinda inconvenient since you''d have to change your formula if you edited the class

Share on other sites
If by "size of a structure" you mean "how much memory this struct occupies", then whatever value is returned by sizeof is correct. Padding pads memory, and if you have a five-byte struct that''s padded to eight bytes, its size in memory will be eight, and not five, bytes.

If you want to use this struct for ie reading stuff from file, you have to disable padding so that you read correctly.

Share on other sites
quote:
Original post by barazor
thats a decent way of doing it, im pretty sure GCC does it as well.

The last time I tried the MSVC-style padding pragma in GCC it gave weird results. They''ve probably fixed it since then though. For information on GCC''s native style of padding manipulation look for information on __attribute__.

Share on other sites
What do you want to know the size of the structure for? Most of the time, whatever sizeof gives you is what you actually want (padding and all)

codeka.com - Just click it.

Share on other sites
I want to use sizeof for reading data from a file.

For example:

      fin.read (reinterpret_cast<char *> (&ChunkDescriptor), sizeof(CHUNK_DESCRIPTOR));

This would not work without the above #pragma code around my CHUNK_DESCRIPTOR structure.

[edited by - JohnG on April 18, 2002 12:44:01 PM]

Share on other sites
You want to read a piece of data from file to memory, byte-by-byte. In order to accomplish this, layout of data that you''re reading in memory must match the layout of that data on disk. Unless you disable packing, the layouts won''t match, because a padded struct is not the same as unpadded struct. You have to turn packing off, otherwise your code won''t work.

Share on other sites
Another idea is to arrange your structures such that each element lines up properly except for maybe the last element, like so:

  typedef struct{    ULONG ulSomeVar;    ULONG ulSomeVar2;    UWORD uwSmallerVar;    UCHAR ucArray[5];} tMyStruct;

It''s how I do it for certain structures that I have to store to and from file. It might not be so easy for you, but it''s worth you thinking about.

Nutts

Share on other sites
If the same program writes the file as the program that reads it (for example, you''re writing a "save game" feature) then you don''t really have to worry about padding, since it''s going to be the same. You only worry about padding when two different programs read/write the file. Even then, you don''t really need to worry if you''re using the same compiler for both the reader and the writer (since it''ll pad the structures the same in both programs).

codeka.com - Just click it.

• 11
• 20
• 10
• 11
• 12


text:
Journal of Formalized Mathematics
Volume 2, 1990
University of Bialystok
Copyright (c) 1990 Association of Mizar Users

The Lattice of Real Numbers. The Lattice of Real Functions

Marek Chmur
Warsaw University, Bialystok
Supported by RPBP.III-24.C1.

Summary.

A proof of the fact, that $\llangle {\Bbb R}, {\rm max}, {\rm min} \rrangle$ is a lattice (real lattice). Some basic properties (real lattice is distributive and modular) of it are proved. The same is done for the set ${\Bbb R}^A$ with operations: max($f(A)$) and min($f(A)$), where ${\Bbb R}^A$ means the set of all functions from $A$ (being non-empty set) to $\Bbb R$, $f$ is just such a function.

MML Identifier: REAL_LAT

The terminology and notation used in this paper have been introduced in the following articles [7] [5] [6] [9] [1] [3] [8] [2] [4]

Contents (PDF format)

Bibliography

[1] Czeslaw Bylinski. Binary operations. Journal of Formalized Mathematics, 1, 1989.
[2] Czeslaw Bylinski. Functions from a set to a set. Journal of Formalized Mathematics, 1, 1989.
[3] Henryk Oryszczyszyn and Krzysztof Prazmowski. Real functions spaces. Journal of Formalized Mathematics, 2, 1990.
[4] Andrzej Trybulec. Function domains and Fr\aenkel operator. Journal of Formalized Mathematics, 2, 1990.
[5] Andrzej Trybulec. Subsets of real numbers. Journal of Formalized Mathematics, Addenda, 2003.
[6] Andrzej Trybulec and Czeslaw Bylinski. Some properties of real numbers operations: min, max, square, and square root. Journal of Formalized Mathematics, 1, 1989.
[7] Zinaida Trybulec. Properties of subsets. Journal of Formalized Mathematics, 1, 1989.
[8] Edmund Woronowicz. Relations and their basic properties. Journal of Formalized Mathematics, 1, 1989.
[9] Stanislaw Zukowski. Introduction to lattice theory. Journal of Formalized Mathematics, 1, 1989.

format: plain


text:
# Recursion-theoretic if-statements

1. Jun 19, 2011

### kanima

Hi, there, I was wondering if anyone knew a good way to implement if-statements in recursion-theoretic terms. Basically, I've come to the understanding that primitive recursion is analogous to a for-loop and mu-recursion to more general while-loops, but is there in general a simple analog of an if-statement in recursion theory?

For example, suppose that given partial recursive functions $g$ and $h$ I had the following algorithm which takes $x$ as input.

if $x < 50$ then
return $g(x)$

else
return $h(x)$

How could I define a partial recursive function computing the above algorithm? What if the condition $x < 50$ were replaced by some more general recursive predicate $R(x)$?

I suspect this shouldn't be so difficult but I am quite new to this subject. If this is the case, I would be quite glad if someone would share their knowledge me.

Thanks!

2. Jun 20, 2011

### Stephen Tashi

I don't know the answer to your question, but it prompted me to look up "partial recursive function". I notice there a considerable difference between how it is defined on the Wikipedia (http://en.wikipedia.org/wiki/Computable_function) versus Wolfram (http://mathworld.wolfram.com/RecursiveFunction.html).

If we use the Wolfram definition, your question could be interpreted as asking how to write a function who definition has an "if ... then " clause as a series of equations. However, I'm not sure that question is significant if we are allowed to use "function symbols" in the equations unless there is some restriction on what functions can be represented by "function symbol". Is there something that says a "function symbol" cannot stand for a function (say on the non-negative integers) which is the list of pairs (x, f(x)) = { (1,0),(2,0),(3,1),(4,1),.... }, which amounts to f(k) = 0 if k < 3 and f(k) = 1 otherwise.

Last edited by a moderator: Apr 26, 2017
3. Jun 20, 2011

### kanima

Sorry, I should have been more specific, especially because of the many guises this same subject appears in.

My definition of partial recursive function is more in line with the one given in the following wikipedia article:
http://en.wikipedia.org/wiki/Μ-recursive_function.

Wikipedia calls them partial $\mu$-recursive functions, and the https://www.amazon.com/Classical-Re...05X/ref=sr_1_1?ie=UTF8&qid=1308593616&sr=8-1"I am following simply calls them partial recursive functions.

The class of functions defined in this way is equivalent to the class of those defined in the Wolfram link. This class of functions is also equivalent to the class of Turing-computable functions: functions whose values can be computed by some Turing machine.

It shouldn't be very difficult to implement conditional if-statements on Turing machines (since they're pretty natural models of computation). However, I am interested in seeing how a function computed by an algorithm with an if-statement can be built up from definition given in the wikipedia page on $\mu$-recursive functions.

Last edited by a moderator: Apr 26, 2017
4. Jun 20, 2011

### Stephen Tashi

Perhaps the place to start is to find a function T(x) that returns 1 if x < 50 and returns 0 otherwise. Then the function you asked about is defined by f(x) = T(x)g(x) + (1-T(x))h(x).

What is a "general recursive predicate"? Is there a definition or theorem that says its evaluation (as true or false , or 1 or 0) is computable.

5. Jun 23, 2011

### kanima

Yes, I believe you're right, and looks like the answer was quite simple after all. By a recursive predicate I did just mean a recursive function that could only give the values 0 or 1. So I guess the function $f$ in your example would be recursive if the predicate $T$ expressing the condition was recursive.


text:
# Proving a sufficient and necessary condition for $f:\, X\to\mathbb{R}\cup\{\pm\infty\}$ to be measurable

I saw the following question:

Denote $\overline{\mathbb{R}}=\mathbb{R}\cup\{\pm\infty\}$, the open sets containing $x\in\mathbb{R}$ are the open sets in $\mathbb{R}$ containing $x$. The open sets containing $\pm\infty$ are the sets of the form $V\cup\{\infty\}$ or $V\cup\{-\infty\}$ accordingly.

Let $(X,S)$ be a measurable space. Prove that $f:\, X\to\overline{\mathbb{R}}$ is measurable iff the following conditions hold:

1. $f^{-1}(\{\infty\}),f^{-1}(\{-\infty\})\in S$

2. $f$ is measurable as a function $f^{-1}(\mathbb{R})\to\mathbb{R}$

My work:

I started with assuming that both conditions hold and I took some $B\in\mathcal{B}(\overline{\mathbb{R}})$ and I wanted to prove that $f^{-1}(B)\in S$, but the problem I have here that I don't really understand how those sets $B\in\mathcal{B}(\overline{\mathbb{R}})$ look like.

So I thought that if I will understand what $S'$ generates $\mathcal{B}(\overline{\mathbb{R}})$ I could use that. I know that the open rays of the form $(-\infty,a)$ or $(a,\infty)$ generate $\mathcal{B}(\mathbb{R})$, and it seems that the sets of the form $(-\infty,a)\cup\{\infty\}$ plus the sets of the form $(a,\infty)\cup\{\infty\}$.

Since $$f^{-1}((-\infty,a)\cup\{\infty\})=f^{-1}((-\infty,a))\cup f^{-1}(\{\infty\})$$ and I know that $f^{-1}(\{\infty\})\in S$ and since its a $\sigma-$algebra I need to prove that $f^{-1}((-\infty,a))\in S$.

I'm guessing this follows from the second condition somehow, but I don't understand how being measurable in $\mathcal{B}(\overline{\mathbb{R}})$ have anything to do with being in $S$ which is a collection of subsets of some space $X$.

Can someone please help me with this question ? am I even on the right track ?

-
What do you mean by: $f$ is measurable as a function $f^{−1}(\mathbb{R})\to \mathbb{R}$? I think the logical condition would be that for any measurable set $A$ in $(\mathbb{R},\mathcal{B}(\mathbb{R}))$, $f^{-1}(A)\in S$, which would help you out immediately... –  Jan Keersmaekers Dec 11 '12 at 10:20
@JanKeersmaekers - please see the answer here: math.stackexchange.com/questions/236788/… –  Belgi Dec 11 '12 at 10:26
@JanKeersmaekers - I understand it as $f^{-1}(S)\in\mathcal{B}(Y)$ where $S\in\mathcal{B}(\mathbb{R}),Y=f^{-1}(\mathbb{R})$ –  Belgi Dec 11 '12 at 10:28

I assume that you are topologising $\overline{\mathbb{R}}$ so that the basic open neighbourhoods of $+ \infty$ are of the form $( a , + \infty ] = ( a , + \infty ) \cup \{ + \infty \}$ for $a \in \mathbb{R}$ (and similarly for the basic open neighbourhoods of $- \infty$).
• By this previous question it turns out that the Borel subsets of $\overline{\mathbb{R}}$ are precisely those sets of the form $B \cup F$ where $B \subseteq \mathbb{R}$ is Borel, and $F \subseteq \{ - \infty , + \infty \}$.
It thus follows that $\{ - \infty \} , \{ + \infty \}$ are Borel subsets of $\overline{\mathbb{R}}$, and also every Borel subset of $\mathbb{R}$ is a Borel subset of $\overline{\mathbb{R}}$.
• Given $Y \subseteq X$, let $S^\prime = \{ A \cap Y : A \in S \}$ denote the restriction of the $\sigma$-algebra $S$ to $Y$. If $Y \in S$ it follows that $S^\prime = \{ A \in S : A \subseteq Y \}$.


text:
# Encasing Taylor Swift

I’m not much of a reddit guy, but I just found a neat one: r/theydidthemath. Here’s the gist: people ask silly questions, and other people looking to do some mathematical recreation answer their silly questions.

Here’s one that tickled my fancy:

If you took the net worth of Taylor Swift, in $20 bills, and used those as building blocks, how big of an enclosure could you build around her and still have it remain soundproof? Great question. Let’s see if we can figure it out. A quick google search indicates that Taylor Swift’s net worth is$240 million USD. WolframAlpha, the source of all sorts of fantastic and weird mathematical facts, states the volume of a $20 USD bill is $$1138 \text{mm}^3$$, which gives us an easy $$2.4\cdot 10^8 \text{USD} \div 20 \times 1138 \text{mm}^3\text{/ USD} = 136.5 \text{m}^3$$ of building material to work with1. Good start. We will assume an enclosure around Taylor Swift is a hemisphere shell, and for good measure, we’ll pad the floor of the enclosure as well. The volume of a hemisphere is $v = \frac{4 \pi \left(r_o^3 - r_i^3\right)}{6}$ where $$r_o$$ and $$r_i$$ are the outer and inner radii of the sphere, respectively. Since sound attenuates over distance, it would be more helpful to describe $$r_i$$ as the attenuation distance (which is to say, the necessary thickness of our shell). We rewrite the hemisphere’s volume as: $v = \frac{4 \pi \left(r^3 - (r-s)^3\right)}{6}$ where $$s$$ is now the shell thickness, and $$r$$ is the outer radius. We now need to add the floor of the enclosure, and since hemispherical shells with a floor aren’t very popular, we’ll need to do the mathematics ourselves. We can model the floor as a bunch of infinitesimally thin of cylinders of varying radii:2 Let $$l$$ be the total height of the stacked cylinders, and thus volume of our floor’s enclosure is: $\int_0^s \pi \left((r-s) \sqrt{1 - \left(\frac{l}{r-s}\right)^2}\right)^2 dl = \frac{1}{3} \pi s \left(3r^2 - 6rs + 2s^2\right)$ Add this to our hemisphere, and the total volume of our enclosure, after simplifying, is thus: $v = \frac{1}{3} \pi s \left(2s - 3r\right)^2$ Onwards. I don’t know much about sound attenuation, but according to this page, sound dissipates according to the law: $A = A_0 e^{-\alpha x}$ where $$A_0$$ is the initial loudness, $$A$$ is the resulting loudness, $$\alpha$$ is the attenuation coefficient of the material, and $$x$$ is the distance the sound travels through the material. The initial question doesn’t state if we’re trying to sound-proof Taylor Swift or a Taylor Swift concert, so let’s try doing both. We assume Taylor will be shouting, so we’ll aim to sound-proof her up to $$A_0 = 78 \text{dB}$$ A rock (we’re being generous, here) concert is approximately $$A_0 = 115 \text{dB}$$. We assume dampening the sound down to the loudness of a whisper is acceptable, so this gives us $$A = 30 \text{dB}$$. Solving our attenuation for $$x$$ (which is $$s$$, the necessary width of our shell to achieve sound dampening), we get: $s = \frac{\ln{A_0}-\ln{A}}{\alpha}$ Great! So given $$\alpha$$, we should be able to compute $$s$$. Strangely, there doesn’t seem to be much in the literature for the sound attenuation coefficient for paper, so we’ll have to use an educated guess here. This page gives coefficients for a few common engineering materials, the closest to paper of which is probably cork. If you were going to actually build this enclosure around poor Taylor, you would probably want to experimentally find a value for this (and have some really good lawyers), but we’ll assume cork is close enough to paper to continue our analysis. Substituting in $$\alpha = 0.15$$, the mean coefficient listed for cork, we get: $s_t = \frac{\ln{78}-\ln{30}}{0.15} = 6.4 \text{m} \\\\ s_c = \frac{\ln{115}-\ln{30}}{0.15} = 9.0 \text{m} \\\\$ where $$s_t$$ is the necessary shell width to silence Taylor Swift, and $$s_c$$, to silence her concert. Because doing math is hard, we’ll use WolframAlpha to do the remaining calculations for us: …which gives us radii smaller than the necessary shell width for the speaking case. Since this is physically impossible, we conclude that such an enclosure can’t actually be constructed. Shame. But wait! We totally fudged that $$\alpha = 0.15$$ number for cork. But maybe paper attenuates more like snow? Maybe not, but hey, we’ve got nothing to work with otherwise. We recompute $$s_t$$, $$s_c$$: $s_t = \frac{\ln{78}-\ln{30}}{0.75} = 1.3 \text{m} \\\\ s_c = \frac{\ln{115}-\ln{30}}{0.75} = 1.8 \text{m} \\\\$ and again run them through WolframAlpha. This time things look better, we get: $r_t = 4.2 \text{m} \\\\ r_c = 4.0 \text{m}$ Success! If you want to silence just Taylor Swift, your enclosure can be $$4.2 \text{m}$$ in radius, and to silence her concert, you lose less than a meter in total radius. Which is super cool, and actually pretty surprising. So, if paper attenuates like snow, you can enclose Taylor Swift in her own money and have her play a concert that no one will ever hear. Marvelous. 1. The original version of this post accidentally calculated this in terms of$1 USD bills, so this number was off by a factor of $$20$$. Thanks to James Barton for spotting this error.

2. The original version of this post approximated this floor as a single cylinder, which is a good approximation only for small $$s$$. Thanks to Marius van Voorden for spotting this error.


text:
Find all School-related info fast with the new School-Specific MBA Forum

 It is currently 06 May 2015, 02:51

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# Events & Promotions

###### Events & Promotions in June
Open Detailed Calendar

# ps 6.7

Author Message
TAGS:
Intern
Joined: 05 Jul 2011
Posts: 8
Followers: 0

Kudos [?]: 1 [0], given: 0

ps 6.7 [#permalink]  05 Jul 2011, 21:20
00:00

Difficulty:

(N/A)

Question Stats:

100% (01:28) correct 0% (00:00) wrong based on 4 sessions
If one root of the equation 2x2 + 3x – k = 0 is 6, what is the value of k?
(A) 90
(B) 42
(C) 18
(D) 10
(E) –10
[Reveal] Spoiler: OA
Manager
Joined: 03 Mar 2011
Posts: 94
Location: United States
Schools: Erasmus (S)
GMAT 1: 730 Q51 V37
GPA: 3.9
Followers: 1

Kudos [?]: 100 [0], given: 12

Re: ps 6.7 [#permalink]  05 Jul 2011, 23:47
We just enter this root into the equation in order to recieve an equation to find the answer!

2*6^2+3*6-k=0
k=72+18=90

_________________

If my post is useful for you not be ashamed to KUDO me!
Let kudo each other!

GMAT Instructor
Joined: 24 Jun 2008
Posts: 978
Location: Toronto
Followers: 281

Kudos [?]: 799 [0], given: 3

Re: ps 6.7 [#permalink]  06 Jul 2011, 00:01
racejockey wrote:
If one root of the equation 2x2 + 3x – k = 0 is 6, what is the value of k?
(A) 90
(B) 42
(C) 18
(D) 10
(E) –10

The question should say that k is a constant. In that case, if 6 is a 'root' of the equation, that just means that x=6 is one solution to the equation. So we can plug in x=6:
\begin{align*} 2x^2 + 3x - k &= 0 \\ 2(6^2) + (3)(6) - k &= 0 \\ 72 + 18 &= k \\ 90 &= k \end{align*}
_________________

Nov 2011: After years of development, I am now making my advanced Quant books and high-level problem sets available for sale. Contact me at ianstewartgmat at gmail.com for details.

Private GMAT Tutor based in Toronto

Re: ps 6.7   [#permalink] 06 Jul 2011, 00:01
Similar topics Replies Last post
Similar
Topics:
710 - Retake? (Guessed on 6-7 of quant) 3 02 May 2012, 07:25
1 What is the value of 10^8 - 6^7? 4 27 Feb 2012, 08:11
1 Is it OK to stick to the first company for 6-7 years? 8 25 Dec 2011, 10:08
The price of a microchip declines 67% every 6 months. At 4 23 Nov 2007, 01:49
OG 67. Defence attorney's have occassionally argued that 4 16 Feb 2006, 08:20
Display posts from previous: Sort by


text:
# [texhax] a 1 inch .pdf == 4.30554pts?

Thu Dec 10 20:53:08 CET 2009

I'm measuring boxes again, and getting some odd dimensions.

First, create a .pdf using the following logo.tex file:

\documentclass{article}
\usepackage{calc}
\usepackage{geometry}
\geometry{
paperwidth=1in,
paperheight=1in,
margin=0mm}
\begin{document}
\noindent\begin{picture}(0,0)\put(0,0){\rule[\baselineskip-1in]{1in}
{1in}}\end{picture}
\end{document}

Then pull it into a second .tex file, and the measured size varies
according to whether or no it's been pulled into a \savebox?:

\documentclass{article}
\usepackage{calc,graphicx}
\usepackage{geometry}
\geometry{
paperwidth=3in,
paperheight=3in,
margin=0mm}
\begin{document}
\newsavebox{\scaledLogo}
\newlength{\LogoVSize}
\sbox{\scaledLogo}{\includegraphics{logo.pdf}}%
\settoheight{\LogoVSize}{\scaledLogo}%
\usebox{\scaledLogo}

\the\LogoVSize

\settoheight{\LogoVSize}{\includegraphics{logo.pdf}}

\the\LogoVSize

\includegraphics{logo.pdf}

\end{document}

For some reason \LogoVSize == 4.30554pt when measuring the \savebox,
but 72.2698pt when measuring the graphic directly --- why is that?

William

--


text:
# Access the indices of vertices, edges and facets from power diagram

15 messages
Open this post in threaded view
|

## Access the indices of vertices, edges and facets from power diagram

 Hi, I am trying to compute the power diagram of some spheres, and access the indices of the vertices. For now, I access the vertices, edges and facets with the Finite_vertices_iterator fvi, Finite_edges_iterator fei and Finite_facets_iterator ffi, and access the vertices as follows: //vertex:    fvi->point() //two vertices of edge:    fei->first->vertex(fei->second)->point()    fei->first->vertex(fei->third)->point() //three vertices of facet:    ffi->first->vertex(0)->point()    ffi->first->vertex(1)->point()    ffi->first->vertex(2)->point() Am I doing it right? The other problem is that is there a way to access the indices of vertices of the edges and faces? Thank you! -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 Hello, Your way to access geometric points is correct. By default there is no index associated to vertices (internally, everything is done with pointers). However, you can use vertices with info (see e.g. this documentation example https://doc.cgal.org/latest/Triangulation_3/Triangulation_3_2regular_with_info_3_8cpp-example.html) and associate a unique ID to each of your vertex. Then you can simply get the ID with fvi->info(). Best, Mael On 18/06/2019 04:32, BRYang wrote: > Hi, I am trying to compute the power diagram of some spheres, and access the > indices of the vertices. > For now, I access the vertices, edges and facets with the > Finite_vertices_iterator fvi, Finite_edges_iterator fei and > Finite_facets_iterator ffi, and access the vertices as follows: > //vertex: >     fvi->point() > //two vertices of edge: >     fei->first->vertex(fei->second)->point() >     fei->first->vertex(fei->third)->point() > //three vertices of facet: >     ffi->first->vertex(0)->point() >     ffi->first->vertex(1)->point() >     ffi->first->vertex(2)->point() > > Am I doing it right? > > The other problem is that is there a way to access the indices of vertices > of the edges and faces? Thank you! > > > > -- > Sent from: http://cgal-discuss.949826.n4.nabble.com/> -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 Thank you, Mael. That's what exactly I want. Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 In reply to this post by MaelRL Hi, Mael. I am now using CGAL with version  4.8.2, and I find that Weighted_point_3 is not a member of 'CGAL::Epick', but a member of 'CGAL::Regular_triangulation_euclidean_traits_3'. Is there still an index associated to each of the vertices in the 4.8.2 version of CGAL? Or we can only fix this with a higher version of CGAL? Thank you! Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 This doesn't change much: although at that point in time, weighted_point_3 was indeed not part of the kernel, the regular triangulation had the same parameters as it still does: template < class Gt, class Tds_ = Default, class Lock_data_structure_ = Default > class Regular_triangulation_3 Thus it would similarly be: typedef CGAL::Regular_triangulation_euclidean_traits_3  Traits; typedef Traits::Weighted_point                              Weighted_point; typedef CGAL::Triangulation_vertex_base_3 Vb0; typedef CGAL::Triangulation_data_structure_3 Tds; typedef CGAL::Regular_triangulation_3               Rt; Rt rt; Rt::Vertex_handle vh = rt.insert(..) vh->info() = my_id; Weighted_point wp = vh->point(); etc. Nevertheless, I can only advise you to switch to a much more recent version so that you can benefit from the various improvements. Best, Mael On 18/06/2019 14:54, BRYang wrote: Hi, Mael. I am now using CGAL with version 4.8.2, and I find that Weighted_point_3 is not a member of 'CGAL::Epick', but a member of 'CGAL::Regular_triangulation_euclidean_traits_3'. Is there still an index associated to each of the vertices in the 4.8.2 version of CGAL? Or we can only fix this with a higher version of CGAL? Thank you! Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 Hi, Mael. I have tried to varify my code as follows: ////////////////////////////////////// #include #include #include #include #include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Regular_triangulation_euclidean_traits_3 Traits; typedef Traits::Bare_point RTPoint; typedef Traits::Weighted_point_3 Weighted_point; typedef CGAL::Triangulation_vertex_base_3 Vb0; typedef CGAL::Triangulation_vertex_base_with_info_3 Vb; typedef CGAL::Regular_triangulation_cell_base_3 Cb; typedef CGAL::Triangulation_data_structure_3 Tds; typedef CGAL::Regular_triangulation_3 Regular_Triangulation; ////////////////////// However, it is still reported that  'Weighted_point_3' is not a member of 'CGAL::Epick'. Could you please help to check if there is something wrong with my code? Thank you! Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 "K" must be "Traits" everywhere (except in the definition of "Traits") On 18/06/2019 16:05, BRYang wrote: > Hi, Mael. I have tried to varify my code as follows: > > ////////////////////////////////////// > > #include > #include > #include > #include > #include > #include > > typedef CGAL::Exact_predicates_inexact_constructions_kernel K; > typedef CGAL::Regular_triangulation_euclidean_traits_3 Traits; > typedef Traits::Bare_point RTPoint; > typedef Traits::Weighted_point_3 Weighted_point; > typedef CGAL::Triangulation_vertex_base_3 Vb0; > typedef CGAL::Triangulation_vertex_base_with_info_3 Vb; > typedef CGAL::Regular_triangulation_cell_base_3 Cb; > typedef CGAL::Triangulation_data_structure_3 Tds; > typedef CGAL::Regular_triangulation_3 > Regular_Triangulation; > > ////////////////////// > > However, it is still reported that  'Weighted_point_3' is not a member of > 'CGAL::Epick'. Could you please help to check if there is something wrong > with my code? > > Thank you! > > Best, > Baorong Yang > > > > -- > Sent from: http://cgal-discuss.949826.n4.nabble.com/> -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 Thank you, Mael. It works now. Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 In reply to this post by MaelRL Hi, Mael. I have now encountered another problem. That is, we can access the vertex of regular triangulation with a vertex handle vh by vh->point(), however, since the vertex isn't defined as a weighted point, we could not get the weight of the vertex by vh->weight(). A way for solving this is get the nearest vertex handle vh of a weighted point wp by the "nearest_power_vertex", but I believe that it could be redundant when the number of weighted points is large. Is there an easy way for accessing the corresponding weighted point of a vertex? Thank you! Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 Should be vh->point()->weight(). Sebastien. On 6/20/19 10:49 AM, BRYang wrote: > Hi, Mael. > > I have now encountered another problem. That is, we can access the vertex of > regular triangulation with a vertex handle vh by vh->point(), however, since > the vertex isn't defined as a weighted point, we could not get the weight of > the vertex by vh->weight(). > > A way for solving this is get the nearest vertex handle vh of a weighted > point wp by the "nearest_power_vertex", but I believe that it could be > redundant when the number of weighted points is large. Is there an easy way > for accessing the corresponding weighted point of a vertex? > > Thank you! > > Best, > Baorong Yang > > > > > -- > Sent from: http://cgal-discuss.949826.n4.nabble.com/> -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 Sorry, I meant: vh->point().weight() Sebastien. On 6/20/19 10:54 AM, Sebastien Loriot (GeometryFactory) wrote: > Should be vh->point()->weight(). > > Sebastien. > > On 6/20/19 10:49 AM, BRYang wrote: >> Hi, Mael. >> >> I have now encountered another problem. That is, we can access the >> vertex of >> regular triangulation with a vertex handle vh by vh->point(), however, >> since >> the vertex isn't defined as a weighted point, we could not get the >> weight of >> the vertex by vh->weight(). >> >> A way for solving this is get the nearest vertex handle vh of a weighted >> point wp by the "nearest_power_vertex", but I believe that it could be >> redundant when the number of weighted points is large. Is there an >> easy way >> for accessing the corresponding weighted point of a vertex? >> >> Thank you! >> >> Best, >> Baorong Yang >> >> >> >> >> -- >> Sent from: http://cgal-discuss.949826.n4.nabble.com/>> -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 Thank you, Sebastien. -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Access the indices of vertices, edges and facets from power diagram

 In reply to this post by MaelRL Hi, Mael. I am trying to access all the facets of the power diagram with Finite_facets_iterator ffi, and I think that there are only three vertices of each facet, that is, I can access the vertices of the facet by: ffi->first->vertex(i)->point(), where i \in {0, 1, 2}, However, I can also access the fourth vertex of the facet by: ffi->first->vertex(3)->point() Am I doing it wrong? Does that mean there are four vertices for each facet, and any three of them could shape a triangle? Thank you! Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
 Hello, You are manipulating the regular triangulation and its faces, not the Voronoi diagram. It is thus normal that the faces are triangles. To manipulate the power diagram, you can look at the dual() functions in your triangulation class, or use the 2D Voronoi adapter. Best, Mael On 02/07/2019 10:35, BRYang wrote: Hi, Mael. I am trying to access all the facets of the power diagram with Finite_facets_iterator ffi, and I think that there are only three vertices of each facet, that is, I can access the vertices of the facet by: ffi->first->vertex(i)->point(), where i \in {0, 1, 2}, However, I can also access the fourth vertex of the facet by: ffi->first->vertex(3)->point() Am I doing it wrong? Does that mean there are four vertices for each facet, and any three of them could shape a triangle? Thank you! Best, Baorong Yang -- Sent from: http://cgal-discuss.949826.n4.nabble.com/